Sunday, April 7, 2013

How to setup PrimeFaces project with JBoss Tools

This post show how to quickly setup a PrimeFaces project with the help of JBoss Tools.

Prerequisite:
1. JBoss Tools Eclipse plugin has been installed.

Related PrimeFaces installation:
  - How to install PrimeFaces Extension
  - How to upgrade to PrimeFaces 4

Steps:
1. Start Eclipse
2. File > New > Other... > JBoss Tools Web > JSF > JSF Project. Next
3. in the Create JSF Project dialog,
    a) fill in desired Project Name, 
    b) select JSF 2.0 for JSF Environment,
    c) select JSFKickStartWithoutLibs for Template (to quickly start the application).
    Next
Create JSF Project dialog

4. Select the Web runtime properties, Finish.
Web Runtime properties dialog

5. copy required jar files into the project lib folder. 
    - JSF
    - PrimeFaces
javax.faces-2.x.x.jar, primefaces-3.x.jar

6. now the application can be started and showing the following screen.
JBoss KickStart JSF template

7. Time to add in PrimeFaces Tags.
    b) Open common.xhtml, change the <head /> to <h:head />
    a) add the following line into the html tag.
xmlns:p="http://primefaces.org/ui"
    b) add PrimeFaces component(s) into page.
adding PrimeFaces tag into page

8. Finally, test the PrimeFaces component.
output: added PrimeFaces component(s)

9. customize the KickStart template, 
    a) common.xhtml, if required different Facelets template.
    b) adding more xhtml into /pages for different screens. 


Done!!

LinkWithin

Related Posts Plugin for WordPress, Blogger...