Dojo Toolkit Tutorial
Today there's a vast choice of Javascript libraries which can be used to create effective layouts in a matter of few lines of code. Dojo Toolkit is an open source modular JavaScript library (or more specifically JavaScript toolkit) designed to ease the rapid development of cross-platform, JavaScript/Ajax-based applications and web sites. In this tutorial we will show how to provide a simple Dojo Toolkit GUI to your RESTeasy Web services.
Dojo Toolkit bears some similarities with JQuery, however it is designed to go beyond JQuery to add full browser-side data objects in addition to a huge variety of other goodness. Some of the strong points of Dojo include:
Introduces the concept of classes, constructors, and inheritance in JavaScript, allowing you to build object-oriented JavaScript code.
Allows you to build more-manageable code by breaking your code into modules.
Simplifies Ajax programming by providing infrastructure code for making asynchronous requests using XMLHttpRequest and cross-browser-compatible DOM-manipulation code.
Attention to details in widgets: (support for i18n, support for l10n, provisions for people with special needs and so on).
You can download Dojo Javascript library at http://dojotoolkit.org/
Or, you can use it on the cloud by including this line in your web page:
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js"></script>
We cannot describe all the characteristics of Dojo in a single article, however we will show how to use it with a JBoss server application delivering RESTful Web services.
(The following code has been test on JBoss AS 6, however it will work as well on JBoss AS 7).
Here's a basic RESTful web service which produces an array of Items. Check out this article for information on how to deploy RESTeasy Web services on JBoss AS.
And the corresponding Wrapper class:
And finally the Item class:

