Tuesday, July 7th, 2020




DWR is an acronymn of Direct Web Remooting, An Remote procedure call (RPC) library which makes it easy to call Java functions from Javascipt and to call Javascript functions from Java.Export your Java code to a browser and include tthe results in your pages.

A Java Servlet running on the web server that processes requests and sends responses back to the web browser.

Javascript running in the browser that sends requests and can dynamically update the webpage.

Call Java Functions like RMI or Soap
Automatically create Java versions of JS
Expose business methods through JS.

Steps on DWR works

• DWR dynamically generates a matching client-side
Javascript class from a backend Java class
➢ Allows you then to write JavaScript code that looks like
conventional RPC/RMI like code, which is much more intuitive than writing raw JavaScript code
• The generated JavaScript class handles remoting details between the browser and the backend server
➢ Handles asynchronous communication via XMLHttpRequest -Invokes the callback function in the JavaScript
➢ You provide the callback function as additional parameter
➢ DWR converts all the parameters and return values between client side Javascript and backend Java
Steps for Building DWR-based AJAX Application follows
1.Copy dwr.jar file into the WEB-INF/lib directory of your web
➢ dwr.jar contains DWR runtime code including the DWR servlet
2.Edit web.xml in the WEB-INF directory
➢ DWR servlet mapping needs to be specified
3.Create dwr.xml file in the WEB-INF directory
➢ You specify which class and which methods of the backend
service you want to expose
4.Write client-side JavaScript code, in which you invoke
methods of remote Java class (or classes) in RPC/RMI-like
5.Build, deploy, test the application


  • Virtually any data-structure between Java and Javascript including binary file uploading and downloading.
  • DWR will generate the JavaScript to allow web browsers to securely call into Java code almost as if it
    was running locally. It can marshal virtually any data including collections, POJOs, XML and binary data like images and PDF files. All that is required is a security policy that defines what is allowed.
  • Exception handling
  • Advanced Cross Siite Request Forgery [ CSRF] protection
  • With Reverse Ajax, DWR allows Java code running on a server to use client side APIs to publish updates to arbitrary groups of browsers. This allows interaction 2 ways – browser calling server and server calling browser. DWR supports Comet, Polling and Piggyback  as ways to publish to browsers.
  • DWR provides integration with Dojo, TIBCO GI, Scriptaculous in the browser, and with Spring, Struts, Guice, Hibernate and others on the server.
  • DWR is Open Source, available under the Apache Software License v2.
    DWR version 3.0.rc1 is the most recent development release. DWR version 2.0 is the current stable release.
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • RSS
  • Technorati
  • Twitter

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

Secure Linux Web Hosting