Web技术概论复习

WEB技术概论复习
名词解释
1. CSS 层叠样式表 Cascading Style Sheets
2. HTML 超文本标记语言 HyperText Markup Language
3. HTTP 超文本传输协议 HyperText Transfer Protocol
4. XML 可扩展标记语言 Extensible Markup Language
5. MIME 多功能互联网邮件扩展程序 MultiPurpose Internet Mail Extensions
6. DOM 文档对象模型 Document Object Model
7. WWW World Wide Web
8. URI Uniform Resource Identifiers
9. URL Uniform Resource Locator
10. REST Representational State Transfer 表现状态转移
11. Ajax Asynchronous Javascript And Xml
12. PHP Hypertext PreProcessor 超文本 预处理器
13. CGI Common GateWay Interface

Tim Berners-lee 是 the father of World Wide Web who majors in physics
Mosaic was the first web brower with a graphical use Interface。


比较JAVA, Javascript,PHP,Ajax,HTML的特点和优缺点

HTML, the Body
  • The following tags should be remembered. Paragraphs,Line Breaks, Headings, Image, Hypertext Links, including one that targets at within the Document, An ordered list and an unordered list. A table with rowspan and colspan Attributes specified, and a HTML comment.
  • Carefully review your homework 2 and comments as well. Learn from those who scored A+.

<!DOCTYPE HTML SYSTEM>
Paragraphs:<p>balabala</p>
line:<hr />
heading:<h1><h1/> 1-6
image:<img src="图片地址" alt="备选文本" />
Hypertext Links:<a href="http://www.example.com/">这是链接</a>
无序列表
<ul>
<li>第一个项目</li>
<li>第二个项目</li>
</ul>
有序列表
<ol>
<li>第一个项目</li>
<li>第二个项目</li>
</ol>
表格:<th> 定义表格表头
<tr> 定义表格里的一行
<td> 定义表格里的一个单元格
<th colspan="2">两列
<th rowspan="2">两行

html comment: <!-- 注释 -->
Ajax
Explain what does Ajax stand for. Why we need it?
Ajax是 Asynchronous Javascript and Xml
运行在客户端
其目的是为了浏览器和服务器异步通信
提高用户程序在客户端方面的交互速度
List several(>=2) Sceneries when Ajax should be used.
鼠标悬停显示提示信息
Google Map显示一小部分地图
用户表单填写和验证
CGI and FORMs

Understand How the URL is encoded before it is send to Web server when a form is submitted.
浏览器通过NAME/VALUE对传递信息,同时对URL进行重新编码:
+代替空格
“%HH“,十六进制的ASCII值,表示非numberic和非字母数据。
=用于分开name和value对
&用来不同的name、value对

Can tell the difference between the GET method and the POST method.
  • Get将表单中数据的按照variable=value的形式,添加到action所指向的URL后面;Post是将表单中的数据放在form的数据体中,按照变量和值相对应的方式,传递到action所指向URL,之后script从stdin中得到消息。
  • Get是不安全的,因为在传输过程,数据被放在请求的URL中,而如今现有的很多服务器、代理服务器或者用户代理都会将请求URL记录到日志文件中,然后放在某个地方,这样就可能会有一些隐私的信息被第三方看到。另外,用户也可以在浏览器上直接看到提交的数据,一些系统内部消息将会一同显示在用户面前。Post的所有操作对用户来说都是不可见的。
  • Get传输的数据量小,这主要是因为受URL长度限制;而Post可以传输大量的数据,所以在上传文件只能使用Post
  • Get限制Form表单的数据集的值必须为ASCII字符;而Post支持整个ISO10646字符集。默认是用ISO-8859-1编码
  • Get是Form的默认方法

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?
CGI要使用新的地址空间,同时会Fork更多的进程,但是PHP已经内嵌到服务器当中了

Java
Understand the new feature of Java 6/7/8, such as: Generics, try-with-resources, Lambda, etc..
这个需要重点复习,听说可能会考
Generics:
为什么要使用泛型?
  • 更强更严格的编译期间类型检查
  • 淘汰类型造型
举例子如下
public class Box<T>  {  
    // T stands for "Type"  
    private T t;  
  
    public void set(T t) { this.t = t; }  
    public T get() { return t; }  
声明如下
Box<Integer> integerBox;  
使用如下
Box<Integer> integerBox = new Box<Integer>();  

try-with-resources:
    try-with-resources语句是一个声明一个或多个资源的  try 语句。一个资源作为一个对象,必须在程序结束之后随之关闭。  try-with-resources语句确保在语句的最后每个资源都被关闭 。任何实现了  java.lang.AutoCloseable的对象, 包括所有实现了  java.io.Closeable 的对象, 都可以用作一个资源。
举个例子
static String readFirstLineFromFile(String path) throws IOException { try (BufferedReader br = new BufferedReader(new FileReader(path))) { return br.readLine(); } }
这里的BufferedReader是一个资源,程序结束后随之关闭

Lambda:
看一下Java 8之前的runnable实现方法,需要4行代码,而使用lambda表达式只需要一行代码。我们在这里做了什么呢?那就是用() -> {}代码块替代了整个 匿名类
举个例子:
new Thread( ()->System.out.println("HELLO WORLD") ).start();

Know differences between applets and servlets, and some knowledge about running them.
applet是客户端的程序,它们可以直接嵌入到网页或者其他特定的容器中,并能够产生特殊的效果。
servlet是服务端器的程序,用于实现服务器功能的扩充,响应客户端请求
相似之处:
* 它们不是独立的应用程序,没有main()方法。
* 它们不是由用户或程序员调用,而是由另外一个应用程序(容器)调用。
* 它们都有一个生存周期,包含init()和destroy()方法。
不同之处:
* Applet具有很好的图形界面(AWT),与浏览器一起,在客户端运行。
* Servlet 则没有图形界面,运行在服务器端。一般是用println输出HTML语句从而使得browser可以显示对应的HTML的例子
JavaScript
You should be able to list the cons or pros of Javascript
pros优点:
  • 浏览器内置了javascript
  • 不需要通过大量的下载就能使得网页变得动态
  • 良好的安全模式-----不能读写本地的磁盘
  • 提供object到DOM的直接路径
cons缺点:
  • 不能做到对于不同的浏览器做到统一
  • 用户可以自己关掉javascript的支持
  • 写的不好,就会变得很慢

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
and unshift (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是面向对象的,但是有一点不同,对象可以使用一些预先给定的方法和值。

Can answer question like: What is javascript sniffer?
javascript 探测器是一个由javascript编写的在LGPL证书下释放的浏览器标识符。
他讲描述当前使用的是哪种浏览器和操作系统。 它还会检查FLASH plugin。
探测器的目的是发现浏览器的类型来显示正确的结果

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


JavaScript is Event driven
What does this mean?
JavaScript是事件驱动的
Name 3 specific events that can be handled by JavaScript
MouseDown Click KeyDown

For event handler or for form submitting, know how to choose a ending "return true" or "return false"
如果某个事件处理程序返回值为 false,那么其含义为通知浏览器不要执行该事件的任何默认操作。

How do JavaScript objects differ from "traditional" software objects such as Java objects?
  • JavaScript不是一个面向对象的语言,而是基于对象的语言
  • JavaScript没有包含类
  • JavaScript的对象既可以是对象,也可以是对象模型
  • JavaScript无法支持类的继承
  • JavaScript无法支持多态性

Which property( appName, appVersion ) of which object( navigator ) indicate the browser name and the version of the browser?
正如所看到的, appName和appVersion 对于navigator的指出了浏览器的名字和版本

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

Javascript supports object-oriented, imperative, and functional programming styles. Please understand these style.
不太懂,听说要考javascript的计时器

简单的应用即可
XML
List more than three ideal application sceneries when XML should be used.
  • 数据交换与信息共享
  • WEB应用
  • 文件结构组织
Understand the grammars of namespaces, DTDs and schemas.
不看了。。。。听说不会考
PHP AND DATABASE
Why PHP array is flexible? By the following figure
  • 在PHP内部,数组元素被存储在以链表组织的单元里,每个单元存储了元素的键和值,存储在存储器单元的位置可以通过键的散列函数来确定
  • 以“字符串”为键的单元,可以通过散列函数来访问
  • 元素都含有指针,这些指针按照创建顺序将元素连接起来,如果是以字符串为键,则可按照顺序访问,以数值为键的则按照数值顺序访问

How does Web Server determine whether a requested document includes PHP code?
服务器根据文档文件扩展名来确定,如果扩展名后缀为.php .phtml .php3 说明其内嵌了PHP

How can a variable used outside a function be accessed by the function?
global static
The lifetime of a static variable in a function begins when the variable is first used in the first execution of the function. Its lifetime ends when the script execution ends.

How can a variable value be shared in different HTTP pages?
通过Cookie和Session
SetCookie(value name, value)
在一个请求中到达的所有 cookie 放置在$_COOKIES 这个隐函数组中,该数组用
cookie 的名字作为元素的键,cookie 的值作为元素的值.

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

session_register(string variable name): A PHP script program store a variable in Session by calling session_register.

How can the value of a form element be accessed by a PHP script?
不论表单是使用GET方法还是POST方法,PHP为任意一个元素建立一个同名变量,这个变量可以被PHP直接使用,叫做外部变量

Understand and remember the so-called Three- tier web structure.

简单的记住就好
三层结构
第一层 WEB浏览器
第二层 WEB-SERVER和数据库应用程序
第三次 数据库系统


WEB Application Frameworks
容器,框架
Model-View-Controller
View: 页面设计
Model:业务模型
Controller:交互控制

目的:
降低模块间依赖
降低不同开发人员的协调难度
便于代码维护

三层体系结构
其把交互流程控制逻辑归为业务逻辑

表示层
业务逻辑层 (controller和模型中的业务逻辑)
数据访问层 (模型中的数据访问逻辑和数据模型)
注意其和MVC区别
区别就在于其业务逻辑层应该对应的是controller,但是其仍然包含模型中的业务逻辑部分,而数据访问层则相对比Model少了上述的部分


依赖注入---描述性的组合方式代替代码调用的组合方式
缺点
问题复杂化
配置内容,IDE不支持代码重构
Refelction效率低
优点
内部依赖变为外部配置,方便代码管理升级

面向切面---软件公共功能和业务逻辑分离
框架提供公共服务,开发者实现业务逻辑

RESTFul-----无状态,扩展性,Web服务
Representational State Transfer REST简写, 表现的状态的迁移
链接构成动态应用
强调回归HTTP,URI的初衷

REST原则
  • 将资源用ID表示 URI 语义上的资源
  • 将资源连接在一起 Hyperlink
  • 用标准方法操作 HTTP:GET/POST/PUT/DELETE
  • 资源多重表述
  • 无状态转移

异步模式----响应大规模并发请求,扩展性
线程池,对每一个请求用一个线程为其服务
好处---
更灵活的并发控制
结构封装,复用
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值