web技术概论复习资料(2)

2019-01-27 12:50

Here is the output of my program:

Servlet是一种服务器端的Java应用程序,具有独立于平台和协议的特性,可以生成动态的Web页面。它担当客户请求(Web浏览器或其他HTTP客户程序)与服务器响应(HTTP服务器上的数据库或应用程序)的中间层。 Servlet是位于Web 服务器内部的服务器端的Java应用程序,与传统的从命令行启动的Java应用程序不同,Servlet由Web服务器进行加载,该Web服务器必须包含支持Servlet的Java虚拟机。 运行servlet步骤:

1环境配置 2编译servlet程序 3配置web.xml 4把编译好的class放入指定目录 5运行 HelloJsp.java import java.io.*;

importjavax.servlet.*; importjavax.servlet.http.*;

public class HelloJsp extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response) throwsIOException, ServletException {

response.setContentType(\PrintWriter out = response.getWriter(); out.println(\out.println(\

out.println(\out.println(\out.println(\

out.println(\out.println(\out.println(\} }

按上数步骤,最后在浏览器中输入: http://localhost:8080/servlet/HelloJsp 如果出现Hello Jsp!的字样就ok了!

You should be able to list the cons or pros of JavaScript. pros

浏览器内嵌了JavaScript的解释器,不需要任何插件

JavaScript可以在不需要大量下载的情况下实现动态网页。如applets

良好的安全性,Javascript不能读写本地硬盘 提供object到DOM的直接路径 cons

Can be difficult to configure scripts for all browsers ‐ this may make pages unreadable.

很难让一个JavaScript在所有浏览器上同样配置,这会使得页面失去可读性 用户可能关闭JavaScript支持 脚本可能跑得很慢。。。

2. Be able to understand Javascript program and modify as required

(1) Control: It uses selection (if, if‐else and switch) and iteration (for and while). 控制:使用分支(if,if-else 和switch)和迭代(for和while)

(2) Variables: Variables are dynamically typed (c.f. perl). You do not have to specify the data type of a variable when you declare it.

变量,变量时动态类型,类似perl。不需要在声明时确定变量类型

(3) Arrays: Used to store collections of variables (or references). The first element is at 0. Do not have a fixed length. New versions of JavaScript can use push, pop, shift andunshift (c.f. perl) BEWARE of browser versions!!

数组:用来储存连续的变量,第一个元素是0,没有确定的长度。新元素可以使用push,pop,shift,unshift.使用时注意浏览器的版本

(4) Functions: Functions are normally declared in the HTML head and invoked (called) as required. They can take a variable number of parameters ‐ the actual

number of parameters is found using the DOM field arguments.length. Functions can have a (single) return value.

方法:方法要不声明在HTML头并且在必要时被调用。他们可以接受一定数量的参数,参数的数量可以在DOM的arguments。length中找到,函数可以有一个返回值。 (5) Objects: JavaScript is object‐oriented ‐ but it's objects are a bit unusual. There

are, as you have seen above with the DOM, some built‐in objects (navigator, document etc) Predetermined methods (e.g. write()) and fields (e.g. value) of these objects can be used.

对象:JavaScript是面向对象的,但是有一点不同,对象可以使用一些预先给定的方法和值。

What is javascript sniffer ?

JavaScript Browser Sniffer is a browser identifier written in JavaScript (EcmaScript) and released under the LGPL license. It will tell which browser, version and operating system you (the visitor) are using. It also detects bots and the Flash plugin. JavaScript browser sniffers are widely used because of the incompatibilities between browsers. Different browsers have different ways understanding the same code written by Javascript. As a result, different browsers will display the same page differently. Javascript browser sniffers detect what web browser a user is working with so as to ensure consistent display of content.

JavaScript探测器是一个由javascript编写的在LGPL证书下释放的浏览器标识符。他将描述你使用哪种版本的浏览器和操作系统。他同样会检查FLASH plugin。js探测器被广泛使用是因为浏览器间的不兼容性。不同的浏览器有不同的解码方式。所以不同浏览器会将同一个页

面显示成不同结果。所以需要探测器来发现浏览器的类型一遍显示正确的结果

How Client‐side Javascript is executed

如果一个XHTML 文档中没有包含任何嵌入式脚本,那么浏览器将逐行读取这个文档,并将其发现的标记、属性和内容呈现在窗口中。如果文档中包含了JavaScript脚本,那么当浏览器遇到这些脚本时,将利用JavaScript 解释器来“执行”脚本。当到达脚本的末尾时,浏览器从解释其中返回,再次开始读取XHTML 文档,并显 示其中的内容。

JavaScript is Event driven What does this mean

事件是某些特殊情况发生时的通知,是一个由浏览器和JavaScript 系统为了响应某些正在发生的情况而隐式创建的对象。事件处理程序是一个脚本,它是隐式执行的,以响应发生的相应时间。通常鼠标或热键的动作我们称之为事件(Event),而由鼠标或热键引发的一连串程序的动作,称之为事件驱动(Event Driver)。而对事

件进行处理程序或函数,我们称之为事件处理程序(Event Handler)。将事件处理程序链接到事件的过程成为注册。

Name 3 specific events that can be handled by JavaScript

blur, change, click, dbclike, focus, keydown, keypress, keyup, load, mousedown, mousemove, mouseout, mouseover,mouseup, reset, select, submit, unload

For event handler or for form submitting, know how to choose a ending \false\

如果某个事件处理程序返回值为 false,那么其含义为通知浏览器不要执行该事件的任何默认操作。

How do JavaScript objects differ from \

JavaScript 不是一种面向对象的语言,它是一种基于对象的语言。JavaScript 没有包含类,它的对象既可以作为对象,又可以作为对象模型,无法支持基于类的继承,也无法支持多态性。

8. Try to understand what does the following page do

What do I do

页面尝试下载一个不可见的图片,当图片下载后,他自动转到onload指示的链接。 The no=Math.random is used to make the Browser thinking that it is getting different picture each time.

Which property(appName, appVersion) of which object(navigator) indicate the browser name and the version of the browser

Why should document.write not be used in an event handler

文档是随着浏览器对XHTML 代码的解析而逐渐显示的。通常情况下,事件是在整 个文档显示之后才发生的。如果write 方法出现在一个事件处理程序中,由此产生 的内容可能将出现在已显示文档的顶部位置。

List more than three ideal application sceneries when XML should be used. (1) 数据交换与信息共享

数据交换与信息共享是XML的最重要的用途之一.XML使得不同计算机应用系统之间交换数据变得容易起来 ,这是因为它的可扩展特性和文档中的元数据 .特别地,XML 在下列领域有重要应用:EDI,Agent,软件设计元素的交换,CRM. (2) Web 应用

XML 文档无疑将成为Web 资源的重要组成部分,而且基于XML 的文档资源使Web搜索引擎的智能化变得容易起来.除此之外,XML 能够用来建立HTML 所不能达到的多层Web 应用,特别地,XML 在Web 应用中有下列用途:集成不同数据源,本地计算,数据的多种显示,支持Web 应用的互操作和集成,基于语义的Data Mining. (3)文件结构组织

尤其是属性文件结构的组织,XML有很大的优势

Know how to format XML by using XSTL.

My catalog

TitleAuthorPublication detailsISBN

Why PHP array is flexible By the following figure.

在PHP 内部,数组的元素被存储在以链表组织的单元里,每个单元存储了元素的 键和值,存储在存储器中的单元位置通过键的散列函数来确定。使用字符串键访 问元素需要通过散列函数完成。但是,元素都含有链表指针,这些指针把它们按 照创建的顺序连接起来,使得在键为字符串时可以按照该顺序来访问它们,如果 键为数值,则按照键的数值顺序来访问。

How does Web Server determine whether a requested document includes PHP code

服务器是通过文档文件的扩展名来判断该文档是否包含 PHP 脚本,如果扩展名为.php、.php3 或.phtml,就说明它嵌入了PHP。

How can a variable used outside a function be accessed by the function global static

How can a variable value be shared in different HTTP pages COOKIE and SESSION

Setcookie(string variable name, value);

在一个请求中到达的所有 cookie 放置在$_COOKIES 这个隐函数组中,该数组用 cookie 的名字作为元素的键,cookie 的值作为元素的值。

session_start( ):PHP程序用session_start()创造一个session,如果这个session已经创建,则session_Start()将所有变量加入程序


web技术概论复习资料(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2010材料导论习题课

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: