Monday, December 26, 2011

Building AJAX JSF Components


AJAX is an acronym for Asynchronous JavaScript and XMLHttpRequest. The XMLHttpRequest object is a de facto standard object provided by browser-based JavaScript implementations, and when used in an asynchronous fashion it allows the page author to communicate with the Web server in the background of the page, without giving the user any visual cue that this communication is occurring. The Web browser’s “spinner” does not spin, the hourglass mouse pointer does not appear, and the browser does not “block” in any way. Using the XMLHttpRequest in concert with standard JavaScript and DOM APIs allows the page author to dynamically update the page with arbitrary server-supplied data.The first implementation of an API for background-based asynchronous communication with the server came from Microsoft in the form of their XMLHTTP ActiveX object. This API was later emulated in a compatible fashion by Netscape and other browsers, enabling users to write Web applications that use XMLHttpRequest and still run on a variety of browsers while minimizing the amount of browser-dependent code required. It has taken a long time to arrive at the point where most users can be assumed to have a browser capable of AJAX, but as of this writing it’s a safe bet.


Even though these technologies had been around for several years their widespread use in Web applications didn’t catch on until Google showed the world how powerful a first-class application of AJAX practices can be. The introduction in 2004 of Google’s e-mail service, which makes heavy use of XMLHttpRequest techniques, inspired a renaissance of interest in JavaScript that ultimately led to what people now call AJAX. Google’s map service also leverages AJAX techniques to good effect. As of this writing, the field of innovation is still wide open and the best practices have yet to fully emerge.


pdf url: http://media.techtarget.com/tss/static/articles/content/JSFReference/JSFReferenceCH11.pdf