Tuesday, November 13, 2012

JSF 2.x Tip of the Day: AJAX Composite Component with AJAX Event Listener

This example is using a JSF composite component to create an AJAX enabled <h:commandButton/> that has an <f:ajax/> component. Additionally, there is a listener that handles the AJAX events that occur.

This is a simple example which demonstrates the concepts, but could be extended to create your own type  of AJAX button like you would find in PrimeFaces, or RichFaces.

The source code for the project can be found here: cc-ajax-commandbutton.zip

The composite component is located in a directory called resources/lotuscc. The only thing interesting about the implementation is the method-signature for the listener.

ajaxCommandButton.xhtml



The index.xhtml page, and IndexBean are very straightforward.

index.xhtml



IndexBean.java


0 comments :

Popular Posts