Ajax的2個開發框架 : DWR, Dojo

  • DWR-Direct web remoting

a Java open source library that helps developers write web sites that include Ajax technology. // 用ajax 寫網站

It allows code in a web browser to use Java functions running on a web server as if those functions were within the browser. //用 web server 上 java 的功能

It consists of two main parts:

1) Code to allow JavaScript to retrieve data from a servlet-based web server using Ajax principles. // 從 server 端取出資料

2) A JavaScript library that makes it easier for the web site developer to dynamically update the web page with the retrieved data. //易於更新網頁

DWR takes a novel approach to Ajax by dynamically generating JavaScript code based on Java classes.  // 用java 類別產生javascript

Thus the web developer can use Java code from JavaScript as if it were local to the web browser;

whereas in reality the Java code runs in the web server and has full access to web server resources.

For security reasons the web developer must configure exactly which Java classes are safe to export (which is often called web.xml or dwr.xml).

This method of remoting functions from Java to JavaScript gives DWR users a feel much like conventional RPC mechanisms like RMI or SOAP, with the benefit that it runs over the web without requiring web browser plug-ins.

DWR does not consider the web browser / web server protocol to be important, and prefers to ensure that the programmer’s interface is natural.

The greatest challenge to this is to marry the asynchronous nature of Ajax with the synchronous nature of normal Java method calls.

In the asynchronous model, result data is only available some time after the initial call is made. DWR solves this problem by allowing the web developer to specify a function to be called when the data is returned using an extra method parameter. This extra method is called CallBack Method. The value returned from the java function will be passed to the callback method.

參: https://en.wikipedia.org/wiki/DWR_(Java)


  • Dojo tool kit:

an open source modular JavaScript library (or more specifically JavaScript toolkit) designed to ease the rapid development of cross-platform, JavaScript/Ajax-based applications and web sites

參: http://www.dojotoolkit.org

http://dojotoolkit.org/reference-guide/1.10/

Advertisements
發表留言

1 則迴響

  1. JavaScript | Joe

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s

%d 位部落客按了讚: