Thursday, January 11th, 2007

Review: Building Ajax JSF Components

Category: Book Reviews

<p>Jason Lee has posted a book review on Building Ajax JSF Components.

The chapter begins by making the grandiose claim that “JSF and AJAX are a perfect match.” The authors then attempt to back up their claim by showing how JSF’s lifecycle phase management helps implement components that use AJAX very cleanly, especially from the component users’ perspective.

After a brief introduction to how AJAX works, the authors implement an employee directory search page using hand-written AJAX code and a servlet (no JSF involved at all). This component, in a fashion similar to the myriad of autocomplete components available, allows the user to type in the name of the desired employee and see, as he types, a list of possible matches appear in a table below the text field.

Complete code for this component is shown, demonstrating what many of us already know: there’s much to be done on the both client and server sides to make AJAX work. It also highlights well one of the downsides of Ajax: there’s a fair amount of work a page developer must do to set up the Ajax environment.

Taking that example, the authors then reimplement the same component as a JSF component. For those new to JSF or unfamiliar with writing JSF components, some of the inner workings of the component can seem a bit overwhelming, but the advantage for those that would like to consume this component is hard to miss. The requirement for reuse goes from copying several JavaScript files into one’s project, adding the script includes, and writing all the (X)HTML markup to display the component to adding one JAR to the project and adding two lines to the markup: the tag library declaration, and this line:

  1. <jcr :directorySearch />

And, if that one example were not enough, Schalk and company go on to implement a spell check text area component for JSF. This component “extends HtmlInputTextArea and provides a simple Ajax-enabled spell-checking facility,” which can be used with a single line of code like this:

  1. <jcr :spellCheckTextArea cols="30" rows="15" value="#{user.interests}" />

Related Content:

  • AJAX JSF Frameworks Review
    This review gives a summary on current commercial JSF Frameworks that use Ajax to update the website. The frameworks Icefaces, Netadvantage and...
  • Book Excerpt: Building AJAX JSF Components
    JavaServer Faces: The Complete Reference offers coverage of JavaServer Faces (JSF) including JSF custom component development. Written by experts...
  • Building Custom JSF UI Components
    One of the key strengths of JavaServer Faces (JSF) is that not only does it provide substantial technology for easy, out of the box component based...
  • Ajax enabling JSF
    Infragistics Inc. has announced the immediate availability of NetAdvantage for JSF 2007 Volume 1, a comprehensive set of AJAX-enabled JavaServer Faces...
  • GMaps4JSF with Ajax PUSH
    GMaps4JSF aims at integrating Google maps with JavaServer Faces (JSF). JSF users will be also able to construct complex street view panoramas and maps...

Posted by Dion Almaer at 3:43 am
1 Comment

+++--
3.6 rating from 49 votes

1 Comment »

Comments feed TrackBack URI

asas

Comment by asdfsdfsdf — January 13, 2007

Leave a comment

You must be logged in to post a comment.