DWR Java AJAX Applications


Author(s): Sami Salkosuo
ISBN: 1847192939
Published: October 2008
Relevance: 4/5
Readability: 4/5
Overall: 4/5

More Packt Publishing Books Reviews …

This book covers many topics with DWR for a client and server side with concrete theory and a good amount the code. Furthermore Geronimo including DataBase and ActiveMQ are covered. Web Services with Eclipse are explained too at a higher level.

This Book is available here

Chapter Highlights

Chapter 1: Introduction

The shortest chapter presents information about Ajax and DWR. Although the chapter is short, it has some important images that reenforce the explanation,giving you a better idea about how Ajax and DWR work

Chapter 2: DWR Features

Here the chapter starts with Reverse Ajax, so Piggyback, Polling and Comet are covered, along with code snippets and configuration. For Comet an image representing it’s interaction with the server side is shown.

After this, the JavaScript files needed by DWR itself in a jsp file are introduced (engine.js,util.js,gi.js), which work handle each one. Snippet code for each library is covered and a big table for most of the functions available for util.js is provided, with a brief explanation and code snippets for each function.

Converters and what types are supported, from the basic to the more complicated (Dates, Collections), are explained too.

A simple list of which frameworks can be integrated with DWR is available, as well as how to enable debug for test/debug purposes.

Chapter 3: Getting Started

The configuration (web.xml) is introduced, with two tables about init parameters (security, load protection). Then we turn to dwr.xml, to see it’s structure (allow, creator and its attributes, has a goodexplanation). But there’s almost nothing about Annotations or Fluent Configuration.

Development configuration including the FireFox browser, the Eclipse IDE(with a server configuration based with Apache Geronimo), and FireBug used for testing and debugging purposes.

Error Handling with DWR covers types, configuration and provides some example code. How to package as a war file with Eclipse and some basic configurations with Geronimo are covered too (how install a .war file from server console or by commands)

Chapter 4: User Interface: Basic Elements

The chapter starts with the introduction for Dynamic User Interface to be developed as a page with many tabs.

  • Tables and Lists
  • Field Completion
  • Forms
  • Navigation Tree

This chapter shows how to create a project and test the configuration for Geronimo (definition and startup with Eclipse). After that the basic configuration for web.xml and dwr.xml is explained, following with a css file. Furthermore a good amount of jsp pages are covered in the chapter for each tab.

Tables and Lists

The source code consists of many functions working together with DOM, DWR (you can see many features in action) and advanced Javascript. The example shows a select list to filter data to load and create a table (practically a dynamic table), each row can be edited (in a field) to save information or cancel, server code is available too

Chapter 5: User Interface: Advanced Elements


A table with many fields (e.g: credit card number, and a date of its expiration) and the classic submit button is developed again in a jsp file, for the server side the validation of the form data is covered

Map Scrolling

If you have used Google Maps before, you’ll know the approach that is is applied here (zoom level used)

Chapter 4 and 5 are well covered with many pages of code, keeping things simple

Chapter 6: Backend Integration

Advanced and more realistic topics are covered here, as the chapter starts with Database Management, then the configuration is done through the embeded Database in Geronimo. The creation of the database and a table and its respectives records to be inserted and even pooling are covered through steps and images

A Java class to manage the database operations is included too, nothing complicated.

Now it’s time to work with Web Services. Here they are configured with Eclipse (Web Service Client). Specific instructions to get a service and generate classes related with credit card validation is covered, along with the generated classes, the author explains an interface and its respective implementation, in my opinion deeper explanation could be necessary.

After of this, the author uses a tool to verify our Web Service Integration, Wireshark is used here

The author adds other interesting topic, Messaging System. Again the configuration for Queue is done with Geronimo, therefore it is related with the creation of ActiveMQ, JMS Resource Group, destination and its type.

Again a Java class to handle the Order System is explained,
this class imports many packages from DWR (e.g: org.directwebremoting.xxx ). The class is little long, covering management with ActiveMQ, of course integrated with DWR and something interesting is that reverse ajax is used but in a non-web class. Testing for this backend work is done with Phyton STOMP client for ActiveMQ

A browser with the application is shown too, getting DWR working together with web services

Chapter 7: Sample Applications

This chapter is very interesting, two sample applications are provided with a lot of pages with code.

The chapter starts with a Collaborative Book Authoring

Among many files with CSS and JSP, almost nine pages of code working with DWR in the JSP are available and almost two pages of explanation of such code too. Perhaps a deeper explanation would have been good. Java classes for server side exists too, and an imitation of a database. By this, I mean working with static Maps "crud" operations, among other classes (the entity, utils). Five pages showing pictures of the application in action are covered too

The second application is a Chatroom

It follows the same logic presentation (about distribution of code and explanation) as the previous application


Web Development is critical and most used in these days, and with Ajax out there, learning many Ajax frameworks is mandatory for us.
DWR is perhaps the framework that is most based in Java and used in many Web Applications, you can even integrate with Spring.

The book covers the client side well with a lot of pages about javascript code working with DWR, and the server side is covered too

For medium developers you would find this book as a very good how-to guide/reference, because has concrete theory and action in samples

For its 228 pages I consider this book a good material for learning DWR in action.


More Packt Publishing Books Reviews …