Press enter to see results or esc to cancel.


Java Server Faces- JSF RichFaces Hello World Project

This tutorial shows step by step method for a JSF RichFaces Hello World project in Netbeans IDE.

  1. First Create a Web Project with Richfaces JSF component enabled.
    1.1 Go to new Project and select Java Web > Web Application Project

    1.2 Enter the Project Name and click next.

    1.3 select the server, here we are selecting server as Tomcat

    1.4 Select Framework as Java Server Faces and Component as Richfaces. If you are doing this first it will ask for
    adding richface library. Click here to see how to add library.
    Check the below link to import the library.
    http://chillyfacts.com/jsf-library-richfaces-not-setup-properly-netbeans-ide/
  2. It would have created the default index.xhtml page
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:h="http://xmlns.jcp.org/jsf/html">
       <h:head>
         <title>Facelet Title</title>
       </h:head>
       <h:body>
         Hello from Facelets
         <br />
         <h:link outcome="welcomeRichfaces" value="Richfaces welcome page" />
        </h:body>
       </html>
    
  3. welcomeRichfaces.xhtml
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
     xmlns:rich="http://richfaces.org/rich"
     xmlns:h="http://java.sun.com/jsf/html">
     <h:head>
     <title>Richfaces Welcome Page</title>
     </h:head>
     <h:body>
     <rich:panel header="Welcome to Richfaces">
     RichFaces is an advanced UI component framework for easily integrating Ajax capabilities into business applications using JSF. Check out the links below to lear more about using RichFaces in your application.
     <ul>
     <li><h:outputLink value="http://richfaces.org" >Richfaces Project Home Page</h:outputLink></li>
     <li><h:outputLink value="http://showcase.richfaces.org" >Richfaces Showcase</h:outputLink></li>
     <li><h:outputLink value="https://community.jboss.org/en/richfaces?view=discussions" >User Forum</h:outputLink></li>
     <li><h:outputLink value="http://www.jboss.org/richfaces/docs" >Richfaces documentation...</h:outputLink>
     <ul>
     <li><h:outputLink value="http://docs.jboss.org/richfaces/latest_4_X/Developer_Guide/en-US/html_single/" >Development Guide</h:outputLink></li>
     <li><h:outputLink value="http://docs.jboss.org/richfaces/latest_4_X/Component_Reference/en-US/html/" >Component Reference</h:outputLink></li>
     <li><h:outputLink value="http://docs.jboss.org/richfaces/latest_4_X/vdldoc/" >Tag Library Docs</h:outputLink></li>
     </ul>
     </li>
     </ul>
     </rich:panel>
     </h:body>
    </html>
    
  4. Just run the project by right click the index.xhtml and click run file.
    http://localhost:8080/RichFaceHelloWorld/faces/index.xhtml

    
    
  5. http://localhost:8080/RichFaceHelloWorld/faces/welcomeRichfaces.xhtml