Apply DWR to Data Validation in an AJAX Application
Learn how to use the open source Direct Web Remoting (DWR) library to dynamically generate JavaScript that includes a callback function parameter for web page updates in AJAX applications.
by Deepak Vohra
April 26, 2007
irect Web Remoting (DWR) is a Java open source library for developing AJAX applications that consists of two components: JavaScript running in the browser that sends requests and dynamically updates the web page with the response, and a servlet running on the server that processes requests and sends responses back to the browser. Remoting in DWR implies that Java class methods are remoted as JavaScript functions in the browser. DWR dynamically generates JavaScript corresponding to Java classes, and the JavaScript may be run in the browser just as any other JavaScript class library.
The generated JavaScript functions that correspond to Java class methods have a callback function as one of the parameters. The remote methods are invoked in the browser using the callback function, and the request is sent to the server using AJAX. When the request is complete AJAX is used to return a response to the browser. The callback function specified in the remote method is invoked with the data returned from the server, and the web page may be updated with the server response.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!