Get Help!

     Download Our ToolBar
     Contact Us
     Link To Us

JSF RichFaces Hello World using eclipse IDE

In this tutorial, we are going to learn on how to develop very first jsf richfaces application using eclipse IDE.


1. Eclipse IDE - Eclipse IDE Tutorial

2. Tomcat Server - Tomcat Server Tutorial

Step-by-Step Guide.

1. Start eclipse IDE.

2. Click on File --> New Java Project

3. Add the details as follows.

Project Name --> jsfautheinticationdemo (You can put anything you want).

The location for the project I have created is under the tomcat webapps directory.

Location --> F:\app\apache-tomcat\webapps\jsfautheinticationdemo.

4. Select the rest of the information as shown in the figure below.

Then click Next.

5. Click Finish on the next screen as we will complete the rest of the configuration later.

6. Right Click on the project name, then click on create the folders as shown below.


7. After creating and expanding the folders the project will look like this:

8. Download the following jars from the following link.

Download JSF Libraries

Once downloaded, unzip all the files under jsfautheinticationdemo/WEB-INF/lib directory.

9.The next step is to add the jars to java build path of the project.

Right Click on the project --> properties --> Java build path --> Libraries.

Click Add Jars and select all the jars which you downloaded from the above link. Once downloaded, the project will look as shown in the image below.

10. The next step is to create the faces-config.xml file.

To create the faces-config.xml, Click WEB-INF --> New --> File and create the file with the name faces-config.xml and copy the below content to the faces-config.xml file and save the file.

<?xml version="1.0"?>
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" version="1.2">

11. The next step is to create the web.xml file.

To create the web.xml, Click WEB-INF --> New --> File and create the file with the name web.xml and copy the below content to the web.xml file and save the file.

		<servlet-name>Faces Servlet</servlet-name>
       <!-- Plugging the "Blue Sky" skin into the project -->
	<!-- Making the RichFaces skin spread to standard HTML controls -->
	<!-- Defining and mapping the RichFaces filter -->
	   <display-name>RichFaces Filter</display-name> 
	   <servlet-name>Faces Servlet</servlet-name>
		<servlet-name>Faces Servlet</servlet-name>

12. The next step is to create the index.jsp file.

To create the index.jsp, Click web --> New --> File and create the file with the name index.jsp and copy the below content to the index.jsp file and save the file.

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@taglib uri="http://mojarra.dev.java.net/mojarra_ext" prefix="mj" %>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
<%@taglib uri="http://richfaces.org/rich" prefix="rich" %>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<title>Login Page</title>
        <h:panelGrid width="40%" columns="2" columnClasses="col1,col2">
	Hello World

13. The next step is to build the project. On eclipse workspace, Click Project --> build project.

As we have created the project under the tomcat webapps directory (deployment home for tomcat), just start the tomcat server and access the application via browser.

Completed. We just developed Hello World JSF Richfaces application using eclipse IDE.

© 2010 ToGoTutor | Copyright | Privacy Policy | |Subscribe to togotutor.com newsfeed|