Ajax on Java

Ajax on JavaAjax on Java by Steven Douglas Olson (O’Reilly) – two reviews provided

This book is a great intro to AJAX. It starts by telling you where to find the few simple pieces you need (Browser, JDK, Tomcat, Ant), and gives a complete working example of a simpleAJAX app. After reading the first 10 pages of the book, you’ll have an AJAX app up and running.

Then it walks you through slightly more advanced topics, like generating XMLdocuments in Java on the server, and parsing them in JavaScript in the browser, using a variety of DOM and SAX techniques. Then the same for JSON documents.

Then on to database examples, again giving you the complete code to get started, including the full JavaScript code for the browser, Java code for the server, and SQL to create and access the database. Also, all the URLs for the downloads, documentation, etc.

The book also goes into some depth. It mentions several gotchas that I had learned the hard way, like the fact that the onkeydown and onkeypress events occur before the value of the key is known, so you have to use onkeyup to catch the new value. Also, the fact that MySQL identifiers are case sensitive on Linux but not on Windows.

Finally, the book includes surveys and quick but complete intros to a variety of related toolkits:

  • JavaScript AJAX toolkits (Dojo, Rico, DWR, Scriptaculous, Prototype)
  • JSP tag libraries that support AJAX (AjaxTags, JavaWebParts, AjaxAnywhere)
  • How to write your own JSP tag library
  • Struts with Ajax (Struts-Layout, custom AJAX with Struts and DWR)
  • JSF (JavaServer Faces) with AJAX
  • GWT (Google Web Toolkit)

Since AJAX is such an exploding field, it is not surprising that some
things are missing from the book, especially since some of them have come into existence since it was published just 2 months ago. You may want to also look into:

  • Comet (an Ajax technique to effectively accomplish “server push”)
  • Rapidly growing support for JSF and AJAX combinations: – AJAX built into various JSF toolkits
  • AJAX wrapper techniques (Ajax4jsf, DynaFaces) for JSF toolkits without built-in AJAX support – JSF wrapper techniques for AJAX toolkits without built-in JSFsupport (jMaki, DojoFaces)
  • Large and growing variety of IDEs, debuggers and other tools for JavaScript and AJAX (FireBug, Selenium, Venkman, Aptana, JSLint, JSDoc, JSUnit, etc.)

Ajax on Java is a great starting point for intermediate to experienced web developers on the Ajax technologies. It starts from the basics, particularly the fundamental Javascript calls that retrieve XML from a server asynchronously, and builds from there by incorporating sample code by hand, and using common Ajax libraries like JSON, Dojo, Scriptaculous, and others. The book continues into more comprehensive frameworks such as GWT, and how to incorporate Ajax into JSF. For the developer who wants to know both what’s going on behind the scenes, and a good introduction into the tools available to build modern Web 2.0 interfaces, this book does the trick.