Skip to main content

{Empty title}

Posted by ahashim on March 12, 2007 at 9:48 AM PDT

Hi, After making few samples with DWR framework, I think it is a very good, powerful and easy to use AJAX framework. I am using it mainly to perform File Upload with progress bar, taking into consideration to be working in all browsers like IE5.5, Netscape, Firefox, Mozilla, Opera, Safari and other browsers in MAC and Linux. DWR logo

I made a simple chat application with DWR and I liked the simplicity of this framework, will present now how to make Hello World and may continue in the future blogging about DWR.

1- Whats is DWR? DWR (Direct Web Remoting) is a Java/JavaScript OpenSource library which allow you to write AJAX enable application with Java without the need to use XMLHTTPRequest and other low-level javascript staff.

2- Why DWR is different? You can invoke Java Bean's method directly from within JavaScript block! No XMLHTTPRequest, No Servlet, You can Recerse AJAX!!! which means calling JavaScript Methods from Java Code!

3- How DWR will handle this staff? The DWR library will create a servlet for you to handle this staff, but you will have to declare your Java classes in dwr.xml file.

4- How to?

  • Get DWR jar file
  • Create Java Class

  • Create dwr.xml file and add definition to this class

  • Configure web.xml to add DWRServlet

  • Create JSP page with HTML controls

  • Write the JavaScript part

As you can see in few steps you can start working with DWR and produce Rich Clients with AJAX features without writting low-level javascript.

The attached war file include the demo source code and can be deployed in any servlet container. I hope that you can see this post useful and would like to continue in DWR posts.