Tuesday, August 24, 2010

Setup Prime Faces in Tomcat 6.0 or >




Prime Faces is awesome it rocks!! Components are sleek and simple. I haven't had a chance to deploy any real time applications yet but I am eagerly waiting for an opportunity to work with JSF 2.0 and Prime Faces frameworks.

Setting up prime faces is simple and the documentation for prime faces is good and has all the details but I had to do little bit of digging and it took couple of hours to setup. I will try to reduce your work.

1. Download tomcat 6 or greater.
2. Copy jsf-api-2.0.2-FCS.jar and jsf-impl-2.0.2-FCS.jar to TOMCAT_HOME\lib directory for tomcat 6 only. If you have installed tomcat 7 ignore this step. Additionally, to make JSTL-1.2 to work in tomcat6 you need to copy el-api-2.2.jar to your TOMCAT_HOME\lib folder, and the el-impl-2.2.jar to your WEB-INF/lib folder and add below context param to web.xml depending on which JSF implementation (myfaces or sun RI).


3. Download primefaces JSF 2.0 jar file primefaces-2.1-SNAPSHOT.jar
4. From MyEclipse create a new web application project. Make sure you have JDK 5 or greater. I am using JDK 1.6 version.
5. MyEclipse will create web.xml for you. Copy the below the contents to web.xml




















7. Copy all the required jar file to the project classpath and also copy them to WEB-INF\
lib directory of the web application.
8. Deploy your web app.


Update: PrimeFaces had it’s own resource servlet to load resources, now with 2.2.M1 it is gone now since primefaces migrated resource management to JSF 2.0 Resource APIs.

PF