Using RichFaces with JBoss AS 5.x - 6

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
In this short tutorial we will show how easily you can get started with Richfaces 3.3 using the latest JBoss distribution. Tested on JBoss 5.1.0 and 6.0.0

We have already published a tutorial about Richfaces 3.2 running on JBoss 4.X
You are adviced to read this tutorial at first if you don't have any notion about RichFaces, otherwise just go on reading.

Let's divide the installation in a few steps:

Step 1 download richfaces latest stable release

Unpack the archive in a folder of your preference.

Step 2 Create a new Web Project from your favourite IDE

A Richfaces Web application needs of course a Web project.
jboss rich faces tutorial example

Once created you need to add a set of libraries to your Web Project.
JBoss Tools has a plugin specific for Rich Faces. This can speed up your Project creation by adding the required configuration files to your project. Check on

Step 3 Add libraries to your Web Project

A Richfaces project needs a set of core libraries plus a few dependancies which needs to be downloaded. Here's the list of libraries which need to be included in your project:

Library Location
richfaces-api-3.3.2.SR1.jar lib folder of your RichFaces distribution
richfaces-impl-3.3.2.SR1.jar lib folder of your RichFaces distribution
richfaces-ui-3.3.2.SR1.jar lib folder of your RichFaces distribution

Step 4 Configure web.xml to load Richfaces libs.

Configure your Web application's web.xml to use JSF Servlet and Richfaces filters. Copy and paste the following XML in your web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" xmlns="" xmlns:web="" xsi:schemaLocation="" id="WebApp_ID" version="2.5">
 <!-- Plugging the "Blue Sky" skin into the project -->

 <display-name>RichFaces Filter</display-name> 

 <servlet-name>Faces Servlet</servlet-name>
<!-- Faces Servlet -->
 <servlet-name>Faces Servlet</servlet-name>
<!-- Faces Servlet Mapping -->
 <servlet-name>Faces Servlet</servlet-name>

Step 5 Create a sample application

The configuration is completed. Now let's add a simple JSP and a JSF Managed bean to verify that your environment has been correclty installed.
Add a page named index.jsp to your project:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<%@ taglib uri="" prefix="f" %>
<%@ taglib uri="" prefix="h" %>
<!-- RichFaces tag library declaration -->
<%@ taglib uri="" prefix="a4j"%>
<%@ taglib uri="" prefix="rich"%>
 <title>RichFaces Greeter</title>
 <rich:panel header="RichFaces Greeter" style="width: 315px">
 <h:outputText value="Your name: " />
 <h:inputText value="#{UserBean.userName}" >
 <f:validateLength minimum="1" maximum="30" />
 <a4j:commandButton value="Get greeting" reRender="greeting" />
 <h:panelGroup id="greeting" >
 <h:outputText value="Hello, " rendered="#{not empty UserBean.userName}" />
 <h:outputText value="#{UserBean.userName}" />
 <h:outputText value="!" rendered="#{not empty UserBean.userName}" />
This JSP page contains a Backing Bean named UserBean which needs to be added to your Project as Class and then declared in the faces-config.xml configuration file.

Here's the bean.UserBean Class:
package bean;

public class UserBean {
  String userName;

  public UserBean() {}

  public String getUserName() {
    return userName;
  public void setUserName(String userName) {
    this.userName = userName;

And finally this is the faces-config.xml file which contains the JSF Bean declaration:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="1.2" 



At this point your Project is ready to run. We include a snapshot of how the Project Explorer should look like :

jboss richfaces example tutorial using
Now run your application by pointing to your index.jsp page:

jboss richfaces example tutorial using