SUN的《AJAX与J2EE》全文译了

2019-06-03 05:49:33王冬梅

  //////////////////////////////////////////////////////////////////////////////////////////


1楼

BS   娄猪



2楼

What   makes   AJAX-based   clients   unique   is   that   the   client   contains   page-specific   control   logic   embedded   as   JavaScript   technology.   The   page   interacts   with   the   JavaScript   technology   based   on   events   such   as   the   document   being   loaded,   a   mouse   click,   focus   changes,   or   even   a   timer.   AJAX   interactions   allow   for   a   clear   separation   of   presentation   logic   from   the   data.   An   HTML   page   can   pull   in   bite-size   pieces   of   data   as   needed   rather   than   reloading   the   whole   page   every   time   a   change   needs   to   be   displayed.   AJAX   will   require   a   different   server-side   architecture   to   support   this   interaction   model.   Traditionally,   server-side   web   applications   have   focused   on   generating   HTML   documents   for   every   client   event   resulting   in   a   call   to   the   server.   The   clients   would   then   refresh   and   re-render   the   complete   HTML   page   for   each   response.   Rich   web   applications   focus   on   a   client   fetching   an   HTML   document   that   acts   as   a   template   or   container   into   which   to   inject   content,   based   on   client   events   using   XML   data   retrieved   from   a   server-side   component.——是什么使得基于AJAX的客户端如此独特?那就是客户端所嵌入的页面特定的控制逻辑、这些控制逻辑以JavaScript代码的形式存在。页面与JavaScript的交互建立在事件的基础上(比如文档加载事件、鼠标点击事件、焦点变化事件、甚至一个时钟事件)。AJAX清楚的将表示逻辑和数据分离开来、一个HTML网页能够在需要的时候获取以比特为单位的数据片段!这不同于以前的有一点变化就必须刷新整个页面的做法。同时AJAX也需要一种完全不同的服务端架构来支持这种交互模式。以前的传统服务端WEB应用专注于为每一个客户端的每一次请求生成HTML页面、每一次客户端接到响应都要刷新和重新渲染整个页面。而我们所谈的WEB应用专注于客户端把HTML文档当作模版或容器、客户端向这个容器中插入内容、作到这些的原理就是每当客户端发生事件、客户端都可以向服务端发出请求并使用服务端返回的XML数据。