Review of Pro Ajax and Java Frameworks
This is a review of Pro Ajax and Java Frameworks by Nathaniel T. Schutta and Ryan Asleson. This book seeks to give the experienced developer of Java web applications the knowledge necessary to add Ajax to their webapps. This is another Ajax book that goes broad rather than deep. Instead of investigating one or two frameworks, it delves into more than a half dozen, both Javascript and Java.
Quick summary: Chapters 2, 3 and 5 are the strongest in the book with useful information on tools, Javascript libraries and enhancing Struts applications with Ajax. The other chapters are not as strong and spend too much time covering old ground.
The book is divided into two parts. Part 1 is an introduction to a variety of Javascript and Java Ajax libraries and frameworks. Part 2 shows how to integrate those libraries and frameworks into existing Java web frameworks such as Struts and JSF. One place that this book differs from other Ajax books is that it doesn't have a chapter introducing the reader to the browser technologies that comprise Ajax. It doesn't dwell on the basics of Javascript, DOM and CSS. It expects you to have already read the Apress books on those topics. Instead, chapter 1 covers what I would call best practices and patterns -- autocomplete, partial page update, draggable DOM.
- Chapter 2 covers the tools of the Ajax development trade -- IDE's, debuggers, HTTP monitors, logging, testing, etc. -- and provides links to where these tools can be downloaded. While those tools that are mentioned -- Venkman, Selenium, Firebug -- are all solid and useful, there is usually only one tool in each category. For Javascript editing, Aptana for Eclipse deserved a mentioned, as did JSMin and Packer for Javascript compression. While Venkman is a great tool for debugging and profiling in Firefox, the various solutions for IE are not addressed. Still, the tools are all solid choices, and the tutorial alone on how to debug Ajax with Selenium is worth the price.
- Chapter 3 looks at three (four if you count Scriptaculous, which is based on Prototype) Javascript Ajax libraries -- Prototype, Taconite and Dojo. Each library is treated with some brief but useful examples along with a short example on how to use them to integrate with a servlet or JSP on the server. As always seems to be the case, Dojo seems to get short shrift. In fairness, dealing with Dojo is probably a worthy subject for an entire book of its own.
- Chapter 4 looks at Direct Web Remoting (DWR) and AjaxTags. The chapter consists mostly of the basic syntax and workings of the frameworks and a few simple examples.
Part 2, as previously mentioned, builds on what the reader has learned about the preceeding Ajax frameworks and libraries and looks at integrating them into existing non-Ajax web application frameworks.
- Chapter 5 is probably the most useful chapter in the book. For those maintaining Struts applications -- and there are a lot of them out there -- it provides a detailed blow by blow on how to turn a simple Struts-based form validation into an Ajax powered on using Prototype. This example doesn't address all possible uses of Ajax, but it does give you a clue on exactly where to splice the Ajax magic into the Struts infrastructure.
- Chapter 6 looks at the Tacos (Ajax enabled) components of the Tapestry framework. This is the first chapter that seems to voilate the book's guiding principle: it spends the lions share of its length in explaining the workings of Tapestry rather than focusing on how to add Ajax to it.
- Chapter 7 combines DWR and the Spring framework to develop a simple inventory control system. Again. lots of time is taken in explaining Spring and relatively little in showing how to add in the Ajax with DWR.
- Chapter 8 shows two ways of adding Ajax to JSF, one with a roll your own approach using raw XHR and no libraries. The other using some Ajax JSF components from the Apache Tomahawk project. Again, too much time is spent explaining vanilla JSF and not enough with the Ajax enhancements. I would have like to see more written on both using and developing Ajax components, since the component is, after all, the heart of JSF.
Summary: As previously mentioned, this book goes broad rather than deep in picking out more than a half dozen frameworks and libraries. Also, the examples throughout the book are little more than snippets, not applications that would demonstrate the development of a full Ajax app. Still, there are a wealth of tool and library tutorials and Ajax conversion best practices in it to make it a valuable reference for anyone looking to enhance a legacy webapp with Ajax.