Sunday, July 01, 2012

JSF Tip of the Day: JSF 2.1 AJAX Examples with PrimeFaces 3.3 and Mojarra 2.1

I have been working with my team at the office to bring them up to speed on using JSF and AJAX. I have been encouraging them to use PrimeFaces to reduce the amount of code required to "AJAXify" JSF components. PrimeFaces has AJAX functionality built in, or uses a simple <p:ajax/> tag to enable it.

However, I think that it is important to be able to use the default Mojarra JSF RI implementation along with its <f:ajax/> functionality both as a tag, and as JavaScript. The code examples below use a combination of PrimeFaces and Mojarra to demonstrate the ease with which you can develop fully functional AJAX applications with JSF.

The examples are done using Apache Maven on NetBeans 7.2 RC 1 and deployed to GlassFish 3.1.2. using JSF 2.1.0 and PrimeFaces 3.3.1.

The code for the project can be downloaded here: ajax-examples.zip

index.xhtml



IndexBean.java


The pictures below demonstrate the before and after of clicking the checkbox, and radio buttons.

Before


After

0 comments :

Popular Posts