Step by step tutorial to setup Primefaces in Netbeans

Introduction

This tutorial shows how to setup Primefaces component suite for a JSF or a Facelets project along with Richfaces in Netbeans6.x. Furthermore, you can learn how to make a hello world application using Primefaces in JSF. First let me give a small intro about Primefaces, which is an open source component suite for Java Server Faces and contains so many obliging features. At first Primefaces is a light weight component that contains more than seventy ajax powered JSF components with rich look and feel.

Read the entire article..

About these ads

About Gift Sam
I am Gift Samuel Asir, currently employing as J2EE Analyst for a concern in Malaysia. Having Master of Computer Applications degree since 2007 , still hardly learning a bit wide in the day to day life to achieve a greater landmark in the Information Highway. I was Born in Palayamkotai, Tamil Nadu(India) on June 1984. Did my Bachelor Degree in Sivakasi and schoolings in Tuticorin. My Passions: To Bring Innovations Wherever I Go And to Get Ten Patents Atleast!!

24 Responses to Step by step tutorial to setup Primefaces in Netbeans

  1. Hi, thanks for the great introduction. I’ve added a link to PrimeFaces wiki.

  2. Gift Sam says:

    Hi cagatay.civici, Thanks for honouring my article!!

  3. Abhijit says:

    Thank you for the step by step introduction. It is very helpful. A Question: We invoke the above jsp page containing the primefaces tag similar to as any other jsf page. Eg# http://myurl/mypage.jsf. So how (or who) is using the Servlet mapping for “Resource Servlet” (as declared in web.xml
    Abhi

    • Hi, Resource Servlet is used internally by PrimeFaces to load resources like scripts, css and images. You never need to use it explicitly.

    • Gift Sam says:

      Hi Abhijit,
      Thanks for your comment. As cagataycivic said Primefaces loads the resources like script, css and images Internally. In web.xml I have specified the loading order of the servlet, Servlets with lower values are loaded before servlets with higher values. So the servlet(Faces Servlet)that manages the request processing lifecycle for web applications which utilize the JavaServer Faces to construct the user interface is loaded first and the PrimeFaces UI module’s servlet(Resource Servlet) loaded second.

  4. James says:

    Hi Gift,

    Thanks for the article. Very informative. How about another blog post that explains mixing and matching richfaces and primefaces components?

  5. Antonio Gurisatti says:

    Gift Sam

    Your article was just great. In about an hour, (I had to download a few things, configure here and there and thre it was. I managed to do a small example in a Seam + Richfaces + Primefaces + Facelets + Hibernate JPA, + EJB3, etc, etc and deploy to to a JBoss AS 4.2.3 and, of course Eclipse 3.4.2 + JBossTools

    Congratulations to Primefaces people. I will continue testing it. Looks promissing!!

    • Gift Sam says:

      Very Happy to hear that you had configured Primefaces in one hour with the help of this Article. Thank you so much for your valuable feedback!!

    • Thomas says:

      Antonio Gurisatti :
      Gift Sam
      Your article was just great. In about an hour, (I had to download a few things, configure here and there and thre it was. I managed to do a small example in a Seam + Richfaces + Primefaces + Facelets + Hibernate JPA, + EJB3, etc, etc and deploy to to a JBoss AS 4.2.3 and, of course Eclipse 3.4.2 + JBossTools
      Congratulations to Primefaces people. I will continue testing it. Looks promissing!!

      Firstly thank you for this article James, but I encounter some difficulties to install primefaces in the same environment as James (ie Seam, RichFaces, primefaces, … facelets tomcat 6.0).
      James, could you post an example of your web.xml, because I think that’s where my problem comes!
      Thank you in advance
      Best regards

      Antonio Gurisatti :
      Gift Sam
      Your article was just great. In about an hour, (I had to download a few things, configure here and there and thre it was. I managed to do a small example in a Seam + Richfaces + Primefaces + Facelets + Hibernate JPA, + EJB3, etc, etc and deploy to to a JBoss AS 4.2.3 and, of course Eclipse 3.4.2 + JBossTools
      Congratulations to Primefaces people. I will continue testing it. Looks promissing!!

    • Christopher Esquea says:

      Hey Antonio, hi first. i know its probably a while, hope you can respond.
      How did you manage to configure primeFaces to work with Seam + Richfaces + facelets + hibernate JPA + EJB3 and make a successful deploy on jboss server with the eclipse and jbossTools
      I’ve been trying to this for over a month now and i have managed to get richfaces and seam ETC, to work but every time i try to add primeFaces to the project i get an exception either on the server when deploying or when trying to access a .seam page like home.seam for example. I keep getting stack trace after stack trace. I have posted on PrimeFaces forum, but i havent gotten too far from when i started.

      Thanks in advance
      Christopher Esquea

      • Christopher Esquea says:

        Christopher Esquea :
        Hey Antonio, hi first. i know its probably a while, hope you can respond.
        How did you manage to configure primeFaces to work with Seam + Richfaces + facelets + hibernate JPA + EJB3 and make a successful deploy on jboss server with the eclipse and jbossTools
        I’ve been trying to this for over a month now and i have managed to get richfaces and seam ETC, to work but every time i try to add primeFaces to the project i get an exception either on the server when deploying or when trying to access a .seam page like home.seam for example. I keep getting stack trace after stack trace. I have posted on PrimeFaces forum, but i havent gotten too far from when i started.
        Thanks in advance
        Christopher Esquea

        Got it, Thanks For The Guidance Gift Sam.
        If anyone needs sum help to get started with seam + primefaces + eclipse and jboss AS, send me a p. message through the primefaces forum under chec69

        thanks Gift Sam again.

  6. Pingback: Charts in JSF Using Primefaces « Technical BrainWave

  7. Steven Shaw says:

    Wondering if the org.ajax4jsf.Filter is required for primefaces? Is primefaces using a4j for partial page rendering?

  8. Gift Sam says:

    Hi Steven Shaw,
    Thanks for your comments and your question is substantive. In this article, I have configured Primefaces together with Richfaces. So I had stated org.ajax4jsf.Filter in the web.xml. If you want configure Primefaces alone with JSF, kindly neglect the Richfaces configuration in web.xml and also remove the Richfaces library.

  9. Pingback: Live Charts in JSF using Primefaces « Technical BrainWave

  10. Sanjay says:

    Hello,
    I am very much new to JSF. But somehow i configured web.xml and now all components work but as soon as i added PrimeFaces framework, the page stopped working.

    This is my web.xml

    javax.faces.PROJECT_STAGE
    Development

    Faces Servlet
    javax.faces.webapp.FacesServlet
    1

    Faces Servlet
    /faces/*

    Resource Servlet

    org.primefaces.resource.ResourceServlet

    Resource Servlet
    /primefaces_resource/*

    30

    faces/index.xhtml

    This is my page

    Facelet Title

    Here is some new Content

    And here is my index.xhtml

    The code compiles nicely.

    When i type
    http://localhost:8080/FaceletMasterPage/faces/ContentPage.xhtml
    in the address bar it works correctly.

    But when i type-
    http://localhost:8080/FaceletMasterPage/primefaces_resource/ContentPage.xhtml

    It throws resource not found 404.
    What can be wrong?

    Thanks in advance :)

    This is header

    Default content

    This is footer

    • Gift Sam says:

      Hi Sanjay,
      No worries!! I reckon the application runs perfectly. The path “http://localhost:8080/FaceletMasterPage/primefaces_resource/ContentPage.xhtml” which you had given is wrong, the path which you had specified first is correct. You should not add “primefaces_resource” instead of “faces”. This is the cause of the 404 error page. Try to invoke a primefaces component in your JSF application and kindly let me know. Also To comment in this article, Kindly wrap your source code by following the link http://wordpress.org/extend/plugins/syntaxhighlighter-plus/other_notes/

  11. thenotifier says:

    hi there,
    congrats on this nice tutorial!
    I’m using Netbeans 6.8 with tomcat 6.0.20.
    I use only JSF no richfaces.
    I’ve followed every step of this tutorial but the problem I’m having is that the jsp page doesn’t Render the primeface compopenent (the p:panel). All I get is exactly this :
    Hello World
    Primefaces is great. My first application using Primefaces
    Footer
    without any graphics. Can someone help me on this please?

  12. thenotifier says:

    thenotifier :
    hi there,
    congrats on this nice tutorial!
    I’m using Netbeans 6.8 with tomcat 6.0.20.
    I use only JSF no richfaces.
    I’ve followed every step of this tutorial but the problem I’m having is that the jsp page doesn’t Render the primeface compopenent (the p:panel). All I get is exactly this :
    Hello World
    Primefaces is great. My first application using Primefaces
    Footer
    without any graphics. Can someone help me on this please?

    here are my web.xml

    Faces Servlet
    javax.faces.webapp.FacesServlet
    1

    Faces Servlet
    /faces/*

    Resource Servlet
    org.primefaces.ui.resource.ResourceServlet
    2

    Resource Servlet
    /primefaces_resources/*

    com.sun.faces.allowTextChildren
    true

    30

    faces/welcomeJSF.jsp

    and this is my jsp page:

    Hello World

    and these are the jars I used:
    atmosphere-compat-jbossweb-0.5.jar
    atmosphere-compat-tomcat-0.5.jar
    atmosphere-compat-weblogic-0.5.jar
    atmosphere-runtime-0.5.jar
    barbecue-1.5-beta1.jar
    commons-fileupload-1.2.1.jar
    commons-io-1.4.jar
    commons-logging-1.1.1.jar
    facestrace-1.1.1-SNAPSHOT.jar
    itext-1.4.8.jar
    jcommon-1.0.0.jar
    jdom-1.0.jar
    jfreechart-1.0.0.jar
    jsf-api-2.0.2-FCS.jar
    jsf-impl-2.0.2-FCS.jar
    jstl-1.2.jar
    junit-3.8.jar
    log4j-1.2.13.jar
    poi-3.2-FINAL.jar
    rome-1.0.jar
    primefaces-2.0.0.jar
    commons-codec-1.4.jar
    commons-discovery-0.4.jar
    guice-2.0.jar
    slf4j-api-1.5.11.jar
    slf4j-simple-1.5.11.jar

  13. thenotifier says:

    thenotifier :

    thenotifier :
    hi there,
    congrats on this nice tutorial!
    I’m using Netbeans 6.8 with tomcat 6.0.20.
    I use only JSF no richfaces.
    I’ve followed every step of this tutorial but the problem I’m having is that the jsp page doesn’t Render the primeface compopenent (the p:panel). All I get is exactly this :
    Hello World
    Primefaces is great. My first application using Primefaces
    Footer
    without any graphics. Can someone help me on this please?

    here are my web.xml
    Faces Servlet
    javax.faces.webapp.FacesServlet
    1
    Faces Servlet
    /faces/*
    Resource Servlet
    org.primefaces.ui.resource.ResourceServlet
    2
    Resource Servlet
    /primefaces_resources/*
    com.sun.faces.allowTextChildren
    true
    30
    faces/welcomeJSF.jsp
    and this is my jsp page:
    Hello World
    and these are the jars I used:
    atmosphere-compat-jbossweb-0.5.jar
    atmosphere-compat-tomcat-0.5.jar
    atmosphere-compat-weblogic-0.5.jar
    atmosphere-runtime-0.5.jar
    barbecue-1.5-beta1.jar
    commons-fileupload-1.2.1.jar
    commons-io-1.4.jar
    commons-logging-1.1.1.jar
    facestrace-1.1.1-SNAPSHOT.jar
    itext-1.4.8.jar
    jcommon-1.0.0.jar
    jdom-1.0.jar
    jfreechart-1.0.0.jar
    jsf-api-2.0.2-FCS.jar
    jsf-impl-2.0.2-FCS.jar
    jstl-1.2.jar
    junit-3.8.jar
    log4j-1.2.13.jar
    poi-3.2-FINAL.jar
    rome-1.0.jar
    primefaces-2.0.0.jar
    commons-codec-1.4.jar
    commons-discovery-0.4.jar
    guice-2.0.jar
    slf4j-api-1.5.11.jar
    slf4j-simple-1.5.11.jar

    sorry the jsp page I used is:

  14. Kwame says:

    I am looking for the source code of the article: Annotation Driven JSF-Spring-JPA-Spring Security-Orchestra to download. The link furnished is broken.
    please help me
    Kwame

  15. Pingback: techbrainwave.com » Live Charts in JSF using Primefaces

  16. juniorsatanas says:

    JSF-Spring-JPA-Spring Security-Orchestra very good !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: