Software Development

How to create a simple JSF2 and Primefaces Application in Eclipse


This article demonstrates how to create a simple JSF that uses Primefaces in Eclipse.

Software Environment

  • Windows 7 Professional SP1
  • Eclipse – Kepler Release
  • Java 1.7 (1.7.0_67 – Windows x86)
  • JSF 2.2
    • Downloaded, and referenced as part of a Dynamic Web Project in Eclipse
  • Primefaces 4.0
    • Downloaded from
    • Place it in the project in WebContent\WEB-INF\lib and reference it

Create a Dynamic Web Project

1. Choose File -> Other… -> Dynamic Web Project (Under Web folder)


2. Specify Project Details


For this article, we set Target runtime to Apache Tomcat v7.0, module version to 3.0, and Configuration to “JavaServer Faces v2.2 Project”. Then, click Next.


Just click next on the second screen.


Leave things as they are and just simply click Next again.


When you reach this point, your eclipse may or may not list anything in JSF Implementation Library right after choosing the Type (e.g., User Library). Click the download button (bluish icon of a diskette with an arrow pointing downward) just located to the right of the list control.


Downloading the JSF Library


Accept the license agreement, and click Finish.



Click Finish.



Download PrimeFaces 4.0


Once primefaces-4.0.jar has been downloaded successfully, put the file in WebContent\WEB-INF\lib in the Eclipse project.

Java Classes

We need two classes – Java Bean and JSF-managed bean classes.

The Java Bean

JSF-Managed Bean

The View

Sample Output


Download the Project



Got comments, or suggestions? Please visit our Facebook page!

You Might Also Like