System News
   
News about Solaris and Sun Microsystems

Free 2 Week Trial!


September 11, 2006
Article #16953
Volume 103, Issue 2
Section: Developer

 


 

AJAX-enabled JavaServer Faces Components
Making It Easier to Use Java Studio Creator

One of the features of AJAX that endears it to developers using JavaServer FacesTM in JavaTM Studio Creator is the ability AJAX provides for updating only parts of a page without the need to reload the entire page. AJAX does this without requiring plug-ins. A variety of AJAX components are available online.

Some of the AJAX components are:

  • Auto-Complete Text Field: uses AJAX requests to provide a list of clickable suggestions as the user types

  • Buy Now Button: initiates a single-order PayPal transaction and posts payment information to the PayPal web site

  • Map Viewer: uses AJAX requests to the Google Maps API to display a map, as well as to pan, zoom, show different views and add balloon markers to the map

  • Popup Calendar: allows for the display of calendars in one of many locals, and provides for both month and year navigation

  • Progress Bar: uses AJAX requests to update the display of progress for a long-running operation

  • Rating: presents a row of stars indicating a rating assigned to an item. When the user assigns a new rating to an item, an AJAX request transmits the rating to the server

  • Rich Textarea Editor: is a text area with a toolbar that lets the user apply formatting (such as bolding, italics, bullets and so forth) similar to a word processing application

  • Select Value Text Field: is similar to Auto-Complete Text Field, but displays the list of suggestions in a dropdown selection field. The image labeled 1 shows the display as the user types, while the image labeled 2 shows the display as the user interacts with the dropdown list.

Another recently released tool, jQuery 1.0, makes using JavaScriptTM easier. jQuery 1.0 can be downloaded.

In his Java BluePrintsTM article, Mark Basler discusses "Using Default Renderers in JavaServer Faces Technology to Add AJAX Functionality to Existing Components." The article is available online.

Basler writes that AJAX programmers routinely turn to reusing components as they continue to work with them. He recommends JavaServer Faces technology as the vehicle of choice to use in building that reusable component library, even though a familiarity with writing custom JavaServer Faces components is a necessity for this use.

A question that arises in this instance is how the component is going to render its markup, Basler says. In this instance, too, the opportunity to reuse components becomes a consideration. A caution, though, as Basler notes, is that it can be a problem to attempt to extend a base renderer class.

Basler discusses the use of the default JavaServer Faces renderers in creating custom components. With the javax.faces.component.UIForm component as a guide, Basler concludes, you can use either of two methods to render the component's markup using base renderer functionality:

  • The Custom Renderer calls a default renderer for base functionality.
  • The Custom Renderer uses a hidden child component and delegates rendering to it.

Code is available online for these methods. [...read more...]

fullsource

Keywords:
Other articles in the Developer section of Volume 103, Issue 2:

See all archived articles in the Developer section.


From the latest issue:



 


Customized news reports about Sun Microsystems. Just the news you need, none of what you don't.
50,000+ Members. 20,000+ Articles Published since 1998.