Advertise with us

Search Mastertheboss

Our eBooks

JBoss richfaces tutorial

RichFaces is an open source framework that greatly enhance JSF including lifecycle, validation, conversion facilities and management of static and dynamic resources. RichFaces components with built-in Ajax support and a highly customizable look-and-feel can be easily incorporated into JSF applications.  

In this tutorial we'll see how to develop some rich pages using Eclipse Editor. It's assumed that the readed is already familiar with JSF concepts. So at first download Richfaces from JBoss site:

Setting up your Richfaces application:

The very first things necessary for an application are the libraries so add to your project the following libraries:
jboss richfaces tutorial

As you can see you need 3 kind of libraries: the rich faces libs you have just downloaded, a JSF implementation (in this case we use MyFaces) and some dependancies required by MyFaces.

We're almost done, we need only a few adds on to the web.xml to get it working correclty:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns=""



        <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>


The parameter org.richfaces.SKIN is used to set up your Rich faces skin, in this case we're using the "blueSky" skin which is quite similar to XP style.

The the parameter org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL is needed to tell JBoss that your application comes with its own JSF implementation, otherwise JBoss will use the default shipped with the bundled tomcat.

The Servlet Filter "RichFaces Filter" is used to enable Ajax capabilities. The Faces Servlet is nothing new if you are familiar with JSF.

Let's write a sample JSP named test.jsp just to check your environment is ok:

<%@ taglib uri="" prefix="a4j"%>
<%@ taglib
uri="" prefix="rich"%>
<%@ taglib
uri="" prefix="h"%>
<%@ taglib
uri="" prefix="f"%>


                <div align="center">

                    <rich:spacer width="1" height="50" />
                    <rich:panel style="width:320px;">
                        <f:facet name="header">
                            <h:outputText value="Login please"></h:outputText>
                        <h:panelGrid columns="2">
                            <h:outputText value="Name: " />
                            <rich:inplaceInput defaultLabel="Enter username" />
                            <h:outputText value="Email:" />
                            <rich:inplaceInput defaultLabel="Enter password" />




Invoke your jsf using the .faces suffix: http://localhost:8080/YourContext/test.faces

This should produre a rich panel panel with a Login form.
jboss richfaces example

Notice that for the keeping it simple the input fields are not bound to any JSF Beans. However in a real world application you should rather register the input fields with a Bean and add an action for example on the submit button.

<rich:inplaceInput  value="#{UserBean.userName}" defaultLabel="Enter username"/>
<rich:inplaceInput  value="#{UserBean.password}" defaultLabel="Enter password"/>
<h:commandButton  id="submit" action="#{UserBean.loginAction}" />

© 2020 All Rights Reserved.

Please publish modules in offcanvas position.