RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


How PrimeFaces Stacks Up Against Other JSF Libraries

PrimeFaces -- a lightweight rich UI library that's easy to use -- is shaping up to be a heavyweight contender for the holy grail of JSF libraries.


On many discussion forums frequented by developers, the question that crops up often is "if you were starting a Java Web project from scratch, what technology would you choose?" There are so many parameters involved in making such a choice that the questioner is usually either someone fairly new to IT or it is really just a leading question and they are waiting for an answer that will allow them to preach their personal choice (almost always one they profit from).

I personally have many preferences that come before JavaServer Faces (JSF), and I'm well aware that I also happen to be in the minority with that view point at this time. Given that JSF is becoming more and more prevalent in J2EE / Java EE Web applications, I am constantly on the hunt for ways to make working with it more productive (something that I am not alone in). Most recently my compass (which points due Lazy most days) led me to PrimeFaces.

PrimeFaces vs. the Competition

A search on Google for PrimeFaces includes the following:

Click here for larger image

Figure 1. Similar Pages to PrimeFaces.org (According to Google)

This shows us that PrimeFaces is poised as an alternative to ICEfaces, MyFaces and OpenFaces ... and someone has done a real good job of promoting their blog. The SEO aspect aside, how does PrimeFaces stack up against more well-known libraries that Google finds to be similar?

On the one hand, PrimeFaces is much easier to use than the common competitors. The syntax is very straightforward, such as this example of using the accordianPanel tag (taken from Accordion Panel – Dynamic page on PrimeFaces.org):

    <p:accordionPanel autoHeight="false" dynamic="true" cache="true">
        <p:tab title="Godfather Part I">
            <h:panelGrid columns="2" cellpadding="10">
                <p:graphicImage value="/images/godfather/godfather1.jpg" />
                <h:outputText  value="The story begins as Don Vito Corleone, the head of a New York Mafia 
family, oversees his daughter's wedding. His beloved son Michael has just come home from the
war, but does not intend to become part of his father's business. Tbut given to ruthless violence
whenever anything stands against the good of the family." /> </h:panelGrid> </p:tab> <p:tab title="Godfather Part II"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage value="/images/godfather/godfather2.jpg" /> <h:outputText value="Francis Ford Coppola's legendary continuation and sequel to his
landmark 1972 film, The_Godfather, parallels the young Vito Corleone's rise with his son Michael's
spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream. In the
early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family.
Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy, killing
the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With
Fanucci gone, Vito's communal stature grows." /> </h:panelGrid> </p:tab> <p:tab title="Godfather Part III"> <h:panelGrid columns="2" cellpadding="10"> <p:graphicImage value="/images/godfather/godfather3.jpg" /> <h:outputText value="After a break of more than 15 years, director Francis Ford Coppola and
writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime
family. Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife
Kay has nearly succeeded in keeping his promise that his family would one day be completely
legitimate." /> </h:panelGrid> </p:tab> </p:accordionPanel> </h:form>

On the other hand, this simplicity is achieved by targeting a very specific environment, i.e., JSF 2.0 with Facelets. As someone who often needs to get up to speed quickly on new products it was a bit disappointing that these prerequisites are not mentioned on either the Getting Started or Why PrimeFaces pages of the project site. While the JSF 2.0 requirement is covered on the FAQ page, the need to use Facelets is not. It would have taken at least two hours less to get a satisfactory Hello World PrimeFaces page up if this fact had been noted more prominently. Once this quirk was discovered, a new PrimeFaces page from scratch took only 15 minutes to get up and running in Eclipse (more on Eclipse later).

The inverse square law of complexity versus flexibility still holds true, and so long as the choice is based on requirements rather than perceived costs, PrimeFaces is a serious contender. Simple generally (though not always, and I'm sure you can think of your own example) leads to increased productivity. If you are not already skilled in Facelets, the paradigm shift needs to be weighed as a factor, balanced by how extensively you will be using the features offered by PrimeFaces and the expected life-span of your application (applications that will be used long-term also tend to be enhanced often).

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date