Most Java™ developers these days appreciate a good mashup, so you might be wondering how well Seam integrates with the technologies dubbed Web 2.0, especially Ajax. It would be pretty cool if you could use Seam to enable partial page updates in JSF or to facilitate a JSF application mashup with Google Maps, wouldn't it? Well, you can -- and better yet, it's easy.
In this final article in the Seamless JSF series, I show you how to use the Seam Remoting API and Ajax4jsf components to facilitate Ajax-style interactions in JSF-based applications. As you'll learn, the best thing about combining Seam with Ajax is that it lets you do all the fancy Web 2.0 stuff without getting tangled up in the JavaScript XMLHttpRequest object. With Seam Remoting and Ajax4jsf, you can communicate with managed beans on the server as if they were local to the browser. The browser and server state remain in sync, and you never have to deal with the low-level API that facilitates their communication.
I'll begin by showing you how Seam facilitates a new, component-based approach to Ajax programming. You will learn to use the Seam Remoting API to communicate between JavaScript and server-side objects via Ajax. Once you understand this new (and easier) approach to Ajax, you can use it to enhance the Open 18 application by doing the following:
- Creating a mashup between the Open 18 course directory and Google Maps.
- Using Ajax4jsf to merge the application's course directory page and course detail page.
- Revisiting the application's Spring integration and making the Spring bean available during the Seam Remoting life cycle.