web技术概论复习资料

更新时间:2024-03-11 09:43:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

web fundamentals by hzqqzh

A user input \about the interactions between the Browser and other servers.

1 浏览器通过URL(统一资源定位符,Uniform / Universal Resource Locator)访问DNS(domain name service),DNS 返回一个IP地址。 2 浏览器用IP地址建立TCP/IP链接

3 浏览器通过TCP/ip链接给服务器发送一个HTTP请求

4依据这个请求,服务器找到合适的文件,生成一个MIME(Multipurpose Internet Mail Extensions\多功能Internet 邮件扩充服务)格式的HTTP响应,并将响应传回浏览器,随后关闭链接。

5 依据HTTP响应的开头信息,浏览器显示收到的文件

注意每一个图片浏览器需要建立一个TCP连接,传送,并关闭链接。 http://162.105.203.19/wst/webtech/unit2/internet.gif

Carefully review the steps taken to install and configure an Apache on the course server. Be able to explain the slight difference between the ASCII mode and BINARY mode of FTP protocol. 安装步骤:

1 解压缩:tar -xzf文件名

2 configure: ./configure --prefix=路径 3make

4 make install

5修改端口:httpd。conf的listen XX 6//apache/bin/apacheclt start

Carefully review the steps taken to install and configure an Apache on the course server. Be able to explain the slight difference between the ASCII mode and BINARY mode of FTP protocol.

ftp是应用层协议,和具体操作系统无关,ASCII 模式和BINARY模式的区别是回车换行的处理,binary模式不对数据进行任何处理,asci模式将回车换行转换为本机的回车字符,比如Unix下是\\n,Windows下是\\r\\n,Mac下是\\r

ascii模式下会转换文件,不能说是不同系统对回车换行解释不同,而是不同的系统有不同的行结束符

(1)unix系统下行结束符是一个字节,即十六进制的0A (2)而ms的系统是两个字节,即十六进制的0D0A

所以当你用ascii方式从unix的ftp server下载文件时(不管是二进制或者文本文件),每检测到一个字节是0A,就会自动插入一个0D,所以如果你的文件是二进制文件比如可执行文件、压缩包什么的,就肯定不能用了。如果你的文件就是unix下的文本文件,你用ascii模式是正确的,要是误用了binary模式, 你在windows上看这个文件是没有换行的,里面是一个个的黑方块。

因此(1)用HTML 和文本编写的文件必须用ASCII模式上传,用BINARY模式上传会破坏文件,导致文件执行出错

(2)BINARY模式用来传送可执行文件,压缩文件,和图片文件

Explain the following queries enclosed in brackets that are inputed to Google: Google搜索常识逻辑为and

(1) cache: The query [cache:] will show the version of the web page that Google has in its cache.

(2) link: The query [link:] will list webpages that have links to the specified webpage.

(3) related: The query [related:] will list web pages that are \ web page.

(4) info: The query [info:] will present some information that Google has about that web page.

(5) define: The query [define:] will provide a definition of the words you enter after it, gathered from various online sources.

(6) stock: Google will treat the rest of the query terms as stock ticker symbols, and will link to a page showing stock information for those symbols.

(7) site: If you include [site:] in your query, Google will restrict the results to those websites in the given domain.

(8) allintitle: If you start a query with [allintitle:], Google will restrict the results to those with all of the query words in the title.

(9) intitle: If you include [intitle:] in your query, Google will restrict the results to documents containing that word in the title.

(10) allinurl: If you start a query with [allinurl:], Google will restrict the results to those with all of the query words in the url.

(11) inurl: If you include [inurl:] in your query, Google will restrict the results to documents containing that word in the url.

(12) filetype: If you include filetype:suffix in your query, Google will restrict the results to pages whose names end in suffix.

All URLs have the same general format: scheme:object-address. You should be able to understand various kinds of URL. Such as URL which executes a CGI program on remote server, URL which points to a port other than 80, URL which points to a local document and URL with a FTP protocol.

scheme告诉浏览器使用哪种通信协议,一般scheme包括http,ftp,telnet,file,mailto and news.格式为scheme//:@:/

MIME stands for Multipurpose Internet Mail Extensions. It helps browser to determine the formats of the document that the browser gets from the Web servers. Generally, a list of MIME specifications in the format of type/subtype is stored in configuration files of each Web server. Web server determines the type of a document by using the filename's extension as the key into a configuration file. The type is transfered by the Content-type field of HTTP response header.

HTTP1.1应答的几个介绍

Connection:表示是否需要持久连接。如果Servlet看到这里的值为“Keep-Alive”,或者看到请求使用的是HTTP 1.1(HTTP 1.1默认进行持久连接),它就可以利用持久连接的优点,当页面包含多个元素时(例如Applet,图片),显著地减少下载所需要的时间。 Expires 应该在什么时候认为文档已经过期,从而不再缓存它

Last-Modified 文档的最后改动时间。客户可以通过If-Modified-Since请求头提供一个日期,该请求将被视为一个条件GET,只有改动时间迟于指定时间的文档才会返回,否则返回一个304(Not Modified)状态。

Set-Cookie 设置和页面关联的Cookie。 Date 当前的GMT时间。

Content-Type 表示后面的文档属于什么MIME类型。Servlet默认为text/plain

cache-control头文件来通知客户端浏览器的缓存方案,常见的取值有private、no-cache、max-age、must-revalidate等,默认为private。

Age: 当代理服务器用自己缓存的实体去响应请求时,用该头部表明该实体从产生到现在经过多长时间了。

HTML标签(一定有<body>) <!DOCTYPE HTML SYSTEM> Paragraphs:<p>balabala</p> line:<hr /> </p><p>heading:<h1><h1/> 1-6 </p><p>image:<imgsrc=\图片地址\备选文本\</p><p>Hypertext Links: 无序列表 </p><p>第一个项目 第二个项目 有序列表 <ol> </p><p>第一个项目 第二个项目 </ol> </p><p>表格:<th>定义表格表头 定义表格里的一行 </p><p>定义表格里的一个单元格 <thcolspan=\两列 <throwspan=\两行 框架 </p><p><frameset rows=\</p><p><frame noresize=\<frameset cols=\</p><p><frame noresize=\</p><p> <frame src=\</frameset> </frameset> </p><p>html comment: </p><p>Explain what does Ajax stand for. Why we need it? Ajar: Asynchronous JavaScript+XML </p><p>目的是是基于web的应用程序在交互速度方面进而在用户体验方面更接近于客户端的桌面应用程序 </p><p>传统的web交互中,客户机向服务器发送消息的方式或者是通过单击链接,或者是提交表单。然后用新文档取代整个浏览器的显示画面。对于复杂的文档,从服务器传个客户端,浏览器再显示,需要大量的时间。所以需要Ajar </p><p>Ajar主要有两点:1服务器和浏览器异步通信,浏览器不需要等待服务器的消息,可以继续做自己的事2服务器正在提供的通常只显示文档中相对较小的一部分,以节约时间 </p><p>哪里使用比较好:验证和表单填写,google map的只显示一小块,鼠标悬停弹出信息,域用户的快速交互 </p><p>How the URL is encoded before it is send to Web server when a form is submitted.? 浏览器通过NAME/VALUE对传递信息,同时对URL进行重新编码: +代替空格 </p><p>“%HH“,十六进制的ASCII值,表示非numberic和非字母数据。 =用于分开name和value对 &用来不同的name、value对 </p><p>Can tell the difference between the GET method and the POST method. </p><p>2、Get将表单中数据的按照variable=value的形式,添加到action所指向的URL后面;Post是将表单中的数据放在form的数据体中,按照变量和值相对应的方式,传递到action所指向URL,之后script从stdin中得到消息。 </p><p>3、Get是不安全的,因为在传输过程,数据被放在请求的URL中,而如今现有的很多服务器、代理服务器或者用户代理都会将请求URL记录到日志文件中,然后放在某个地方,这样就可能会有一些隐私的信息被第三方看到。另外,用户也可以在浏览器上直接看到提交的数据,一些系统内部消息将会一同显示在用户面前。Post的所有操作对用户来说都是不可见的。 </p><p>4、Get传输的数据量小,这主要是因为受URL长度限制;而Post可以传输大量的数据,所以在上传文件只能使用Post 5、Get限制Form表单的数据集的值必须为ASCII字符;而Post支持整个ISO10646字符集。默认是用ISO-8859-1编码 6、Get是Form的默认方法。 </p><p>Understand the slight difference between the executing mechanism of a CGI program and that of a PHP program. Why CGI programs are of higher cost comparing to PHP programs? </p><p>对于CGI,服务器需要创建更多的地址空间同时需要fork进程,PHP的执行已经嵌入到服务器中 </p><p>what is java? </p><p>Java,是由Sun公司于1995年5月推出的Java程序设计语言和Java平台的总称。 特点:简单,面向对象,分布式,健壮,解释型,多线程,动态 public class Hello { </p><p>public static void main(String args []) { System.out.println(\ } } </p><p>applet和servlet 最简单版本 applet是客户端的程序,它们可以直接嵌入到网页或者其他特定的容器中,并能够产生特殊的效果。 </p><p> servlet是服务端器的程序,用于实现服务器功能的扩充,响应客户端请求 相似之处: </p><p> * 它们不是独立的应用程序,没有main()方法。 </p><p> * 它们不是由用户或程序员调用,而是由另外一个应用程序(容器)调用。 * 它们都有一个生存周期,包含init()和destroy()方法。 不同之处: </p><p> * Applet具有很好的图形界面(AWT),与浏览器一起,在客户端运行。 * Servlet 则没有图形界面,运行在服务器端。 </p><p>含有Applet的网页的HTML文件代码中部带有和</applet>这样一对标记,当支持Java的网络浏览器遇到这对标记时,就将下载相应的小应用程序代码并在本地计算机上执行该Applet。 Java Applet 是用Java 语言编写的一些小应用程序,这些程序是直接嵌入到页面中,由支持Java的浏览器(IE 或Nescape)解释执行能够产生特殊效果的程序。由于Applet是在用户的计算机上执行的,所以它的执行速度不受网络带宽或者Modem存取速度的限制。 样例 importjava.applet.Applet; importjava.awt.Graphics; public class HelloWorld extends Applet { public void paint(Graphics g) { g.drawString(\ } } <HTML> <HEAD> <TITLE> A Simple Program

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()将所有变量加入程序

session_register(string variable name): 将一个变量存入session() 会话的键/值对通过对$_SESSION 数组赋值来创建或修改。

How can the value of a form element be accessed by a PHP script?

无论form使用GET还是POST方法,PHP为任任意一个元素建立一个同名变量。这个变量可以直接被PHP使用。他叫做外部变量。

推荐的方法是使用隐含的数组,$_POST 和$_GET,来存储表单值。这些数组的键与表单元素名称匹配,值和客户输入的值匹配。

Understand and remember the so‐called Three‐ tier structure.

三层体系结构:第一层是web 浏览器,它提供了用户接口;中间层通常具有web 服务器以及需要访问数据库的应用程序;第三层具有数据库服务器和数据库本身。

Carefully review the procedure you have carried through that enables your Apache server to support PHP. (1) mkdirphp

(2) tar ‐xjf php‐5.0.5.tar.bz2 to un‐tar it. The suffix bz2 means another compression format. A j option is needed to run the un‐tar. (3) ./configure

‐‐prefix=/home/2009/y2009g0/php

‐‐exec‐prefix=/home/2009/y2009g0/php ‐‐with‐mysql

‐‐with‐apxs2=/home/2009/y2009g0/apache/bin/apxs

The '‐‐prefix' specify where the PHP system locates, the '‐‐with‐mysql' tells that we are going to access MySQL database, the '‐‐with‐apxs2' specify the file name which keep all information about the Apache Server, the ending 2 say that you are using Apahce of version 2.0 or higher. (4) make

(5) make install

(6) check if there is a file named libphp5.so in the directory ~/apache/modules (7) Edit the configuration file of Apache httpd.conf .

LoadModule php5_module modules/libphp5.so //which tells the apache to load the PHP module when it is started.

AddType application/x‐httpd‐php .php //Which tell Apache that files with a .php suffix are PHP script.

(8) Copy a sample php.ini to this directory by executing the following command: cp ~/php‐5.0.5/php.ini‐dist ~/php/lib/php.ini

(9) Edit this ~/php/lib/php.ini file, turn on the switch register_globals =On. By doing this, in PHP program, you can directly access those valuse of Form fields and Cookie variable as a common PHP variable by refering the name. (10) Stop the Apache Server by runing: apachectl stop and start it by runng: apachectl start (11)

Remember the three fundamental changes that blog brings to Web. (1) From Readable to Writable

Before Blog, from the viewpoint of a common Web user, the Web is Build(Written) and Updated by some professionals who expert in Web Wide Web. Web is just a tremendous information resources which can be refered to. After Blog, Web becomes writable for general users, they can easily build their own blogs, wirte Posts and Comments on other posts. Helped by some technlogies, such as CSS, XML which separate the content of the Web from the presentation of Web, the writing of the Web focus on the content. The threshold for creating a nice Web site is dramatically lowered.

在blog出现前,对于一个普通的web使用者,web是被专业人员建设和升级的。web仅仅是一个巨大的信息源。在blog出现后,web可以被普通人编写,他们可以很容易建立自己的blog,写文章和评论别人的问斩,在CSS,XML的帮助下,web文章的编写者可以专注于文章本身。建立一个好的web的门槛变得很低 (2) From Pull to Push

With this Push mechanism, a user can subscribe to some Web sites he or she is interested and regularly receive page‐updates pushed by those Web sites. Obviously, it is not reasonable to always push the whole web page. There must be some syndication and briefing technologies. VSS or ATOM can be be classified as this kind of technology. The brief updates are also called Blog feed. User use RSS Aggregator to receive the Blog feeds.

在PUSH机制的帮助下,用户可以订阅网站的内容并且定期收到网站push的信息。VSS和ATOM就是这种技术。这种基本的升级也叫做blog feed。用户用RSS聚合器接受blog feeds。 (3) Form one‐way link to two‐way reference

\means the following nature of traditional World Wide Web: Page A includes a hyper‐text link which points to page B, while page B knows nothing about this reference. Track Back and Ping Back used to build a backward link from page B to page A. Page B could be a comment on Page A. Page B resides on a separate Host. This is also called remote commenting. 单向是说在传统的web中,页A有一个超链接但想到指向页B,但是页B并不知道这个链接。track back和 ping back用于建立一个从B到A 的链接。B可以是A的一个评论。页B属于一个独立的Host。这也叫远程评论

Could classify technologies accordingly.Post and Comments, CSS, XML, ATOM, RSS, Content aggregation.

(1) From readable to writable: Posts and Comments; CSS, XML (2) From pull to push: VSS or ATOM; RSS

(3) From one‐way link to two‐way reference: Trackback; Content aggregation

What is wiki

一种多人协作的写作工具。Wiki 站点可以有多人(甚至任何访问者)维护,每个人都可以发表自己的意见,或者对共同的主题进行扩展或者探讨。Wiki 也指一种超文本系统。这种超文本系统支持面向社群的协作式写作,同时也包括一组支持这种写作的辅助工具。

本文来源:https://www.bwwdw.com/article/zmz8.html

Top