DWR is an engine that can disclose the method of the server-side Java object to the JavaScript code. Use DWR to effectively remove all requests - response cycles of AJAX from the application code. This means that the client code does not need to directly process the XMLHttpRequest object or the server's response. The serialization code of the object is no longer needed or using a third-party tool to turn the object into XML. Even no longer need to write a servlet code to adjust the AJAX request to the call to the Java domain object. DWR is an open source using the Apache license agreement solution, which contains server-side Java libraries, a DWR servlet, and JavaScript libraries. Although DWR is not the only AJAX-RPC kit on the Java platform, it is most mature and provides a number of useful features. DWR is deployed as a servlet in a web application. Watch it as a black box, this servlet has two main roles: First, for each class, DWR dynamically generates JavaScript included in the web page. The generated JavaScript contains the stub function, which represents the corresponding method on the Java class and performs XMLHttpRequest after the scene. These requests are sent to DWR. At this point it is to transfer the request to the server-side Java object to call and put the return value of the method to the servlet response to send back to the client, encoded into JavaScript. DWR also provides a JavaScript tool function that helps perform a common user interface task.
Add:
DWR.XML
Reference Dynamic Generated JavaScript in the page