Wednesday, January 29, 2014

How to configure Primefaces 5.1 and JSF 2.2 in Eclipse IDE

Hi there!

Today I will show you how to configure Primefaces 4.0 with JSF 2.2 in the Eclipse Kepler IDE (v4.3).

If you don't have any idea of what we 're talking about or it's the first time that you 're facing J2EE, you may find interesting my first two articles about JSF 2.0 and Eclipse integration, in JCG community :
  1. JSF 2.0 Eclipse IDE Support
  2. Hello World Example with JSF 2.0
Now that you 're enough experienced, let's link Primefaces with JSF and Eclipse, too. There are two main actions that we need to no, in order to implement this:

We first need to add the following dependency, in the pom.xml file:

<dependency>
   <groupId>org.primefaces</groupId>
   <artifactId>primefaces</artifactId>
   <version>5.1</version>
</dependency>

We 're pretty ready! Naaah, don't be in a rush. As you might found out by yourself, Primefaces deals with the visual components of our websites, so obviously, the xhtml reference that we provided (in the fore-mentioned links/articles) isn't enough; we need to add two more references, in order to get the Primefaces up and running:

<html xmlns="http://www.w3.org/1999/xhtml"    
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui" >

That was it. You 're ready to start developing your awesome look-and-feel web applications with JSF and Primefaces.

I also created a simple gist for the purpose of this configuration. 


Cheers!

No comments:

Post a Comment