——AJAX交互剖析:来看一个AJAX使能的J2EE应用:名为ValidateServlet的Servlet验证表单数据、但是要求不能对整个页面刷新。步骤如下:
1、A client event occurs. ——客户端事件发生。
2、An XMLHttpRequest object is created and configured. ——一个XMLHttpRequest对象被创建并配置。
3、The XMLHttpRequest object makes a call. ——XMLHttpRequest对象发出请求。
4、The request is processed by the ValidateServlet. ——请求被ValidateServlet处理。
5、The ValidateServlet returns an XML document containing the result. ——ValidateServlet返回一个包含结果的XML文档。
6、The XMLHttpRequest object calls the callback() function and processes the result. ——XMLHttpRequest对象调用callback()函数并处理结果。
7、The HTML DOM is updated.——HTML文档对象被更新。
3楼
各个步骤细节如下:
1. A client event occurs.——客户端事件发生:
点击链接或表单元素的键盘事件引发JavaScript函数validate():
<input type="text"
size="20"
id="userid"
name="id"
onkeyup="validate();">










