Welcome!

Java Authors: Jeremy Geelan, Liz McMillan, Hari Gottipati, Tad Anderson, Yakov Fain

Related Topics: Open Source, Java

Open Source: Article

A DWR Data Store for Dojo

Putting two powerful AJAX libraries to work for you

The Dojo data API is a set of interfaces that data providers can implement so Dojo widgets and other application components can access external data. In DOJO-speak data providers that implement these interfaces are called data stores. A number of widgets supplied by the toolkit are capable of accessing data from these data stores. By presenting data as generic items with attributes they hide the underlying complexity of both the structure and access mechanism from consumers of the data. A good example of such a data store is the ItemFileReadStore, which is capable of reading JSON data in a specific pre-defined format from a remote location represented by a URL. Other data stores in various states of maturity are available in the extensions package (DojoX).

In a J2EE-based Web application information to be displayed on the browser is often encapsulated as a JavaBean on the server. The DWR library allows JavaScript on the browser to call a method in a remote Java class. JavaBeans returned by this remote method are made available in JSON format to the caller. In this article we will combine DWR with Dojo to create a data store that can be used by widgets to fetch JavaBeans from the server and consume them as JavaScript objects.

More Stories By Santosh Werghis

Sonny Werghis is an IT architect with IBM Global Services. He has over 10 years of experience with development of enterprise software using Java EE technologies. At IBM he specializes in application architecture for custom application development. His current areas of interest include Web 2.0 and RIA.

Comments (1) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
nonny 04/17/08 08:24:02 AM EDT

Why error >> " this._dwrMethod(function(data){
try{
self._items = data;
self._loadComplete = true;
self._loadInProgress = false;

filter(args, self._items);
}catch(e){
self._loadComplete = true;
self._loadInProgress = false;
errorCallback(e, args);
}
});
"