In this tutorial I will write about how to setup Primefaces with eclipse IDE. You will need to have the following available:
- Eclipse IDE for Java EE developers, which can be downloaded from eclipse website , I am using Indigo.
- JBoss Tools for creating and editing xhtml files. This is the JBoss tools update sites, you can just install JBoss tools richfaces.
- Primefaces 2.2.1 bundle, which can be downloaded from Primefaces website.
- Tomcat 7, which can be downloaded from Apache website.
- JSF 2.1.3 jar files can be downloaded from Java.net.
- el api 2.2 can be downloaded from here.
- el impl 2.2 can be downloaded from here.
After downloading those files, you will need to do the following:
- Extract tomcat to your hard disk, lets say to d:\tomcat.
- Extract eclipse to your hard disk, lets say to d:\eclipse.
- Run eclipse by running the file d:\eclipse\eclipse.exe, and entering "d:\workspaces\Primefaces" as your workspace.
- Create a new dynamic web project and name it Primefaces with web module version "3",before finishing the project creation wizard you will have to add the JavaServer Faces 2.0 facet by clicking on the modify button in the configuration section and selecting the associated checkbox.
- Click on next till you reach the JSF capabilities screen, Chose "disable library configuration" and then click on finish
- copy the following jar files that we've downloaded before into your web-inf/lib directory:
el-api-2.2.jar
el-impl-2.2.jar
javax.faces.jar
primefaces-2.2.jar - Your web.xml should look like the following
- create a new folder in your WebContent folder and name it common, create a new xhtml file inside it and name it login.xhtml. When creating an xhtml file you might be prompted to add JSF capabilities, click the Add JSF capabilities if you get this message
- add a button with label Test to the login.xhtml file as follows
- Use your tomcat installation to create a new server, add the Primefaces project to the configured list and click finish, after that run the server
- Goto http://localhost:yourserverport/Primefaces/common/login.jsf and you should be able to view a button with the label test on it
Thank you very much for this tutorial! very helpful.
ReplyDeleteYour welcome
DeleteGOOD STUFF!!
ReplyDeleteExcellent! Thank you!
Henrique.
Where do you place your .xhtml files? WebContent? WEB-INF? Directory under WEB-INF. I can't get navigation unless I place them in WebContent.
ReplyDeleteWhatever placed in WEB-INF is not visible to user or simple way its hidden..
ReplyDelete