PrimeFaces is a suite of components built on top of JSF 2.x, giving you lots of first-class widgets to use on a Rich Internet Application (RIA) solution, such as charts and mind maps. Its only requirement is to choose between Oracle Mojarra and Apache MyFaces, both JSF 2.0 implementations, and to reference the chosen one. The current implementation version at the time of writing is 3.5.
To use PrimeFaces, we must download it from http://www.primefaces.org/downloads.html. You can choose between Binary, Source, and Bundle packages.
The official documentation is a PDF available at http://www.primefaces.org/documentation.html with details on every component of the framework. And the most valuable source of information is the ShowCase page, with samples and working code for every component, available at http://www.primefaces.org/showcase/ui/.
PrimeFaces can be configured with JQuery's ThemeRoller (http://jqueryui.com/themeroller/), and there are lots of predefined themes available at http://primefaces.org/themes.html. You can also access the showcase mentioned previously and see how the themes feel like by selecting different names from the top left drop-down box.
Theme packages can be downloaded from http://repository.primefaces.org/org/primefaces/themes/. Grab the themes that appeal to you by clicking on the folder with the same name, then clicking again on the highest version number and selecting the file with extension .jar
.
Shared libraries are a handy way to make different types of resources available between applications deployed on the same domain, avoiding the need to add them inside each application package or to change the classpath (and the unavoidable restart to make the new libraries available).
There is another way to share libraries called optional packages, where you can deploy a single plain JAR file as a library, and reference it from your application. The main difference between the two concepts is that a shared library can be a Java EE module (have a few EJBs, for instance), and an optional package is a standard Java library that can be shared by many applications without having to put the library inside the deployment package or adding it to the server's classpath.
For a full list of available modules, the differences between shared libraries and optional packages, and detailed specs on how to build and reference them, refer to http://docs.oracle.com/middleware/1212/wls/WLPRG/libraries.htm.
The following steps show how to create the shared library:
cd /opt/packt/etc mkdir ./primeSL cd primeSL mkdir ./META-INF mkdir ./WEB-INF mkdir ./WEB-INF/lib
primefaces-3.5.jar
, ui-lightness-1.0.10.jar
and any other themes you chose—to the lib
folder.MANIFEST.MF
inside META-INF
with the following content:Manifest-Version: 1.0 Extension-Name: primefaces Specification-Version: 3.5 Implementation-Version: 3.5
/opt/packt/etc/primeSL
into a file named primefacesSL.war
:cd /opt/packt/etc/primeSL zip -r primeSL.war */*
Now that we have the assembled package, here's some insight about the MANIFEST.MF
file we just created:
extension-name
attribute is the name that we're going to use to reference the shared library at our projectsspecification-version
attribute is used to indicate which version this library exposesimplementation-version
is related to package versioning, so the developer can pin to a specific build version, if necessary