richfaces 4 tutorial

Java EE 6 training. Part 3: Richfaces

In this tutorial we will continue our training session by adding RichFaces libraries to our example Java EE 6 application. Richfaces is an advanced UI component framework for creating advanced JSF application leveraging rich component features and Ajax capabilities.



At first download the latest release 4.X.X of Richfaces framework from here.


The distribution when unpacked contains the following folders:

folderarchetypes Can be used to create a basic Richfaces application generated with  Maven
artifacts Contains Richfaces libraries
docs Contains the JavaDocs for Richfaces
examples Contains the Richfaces core demo suite

Setting up your Richfaces 4 application

In order to create a Richfaces application you have several option: you can either use Maven for picking up the correct libraries or manually configure your web application libs.

You can basically configure Richfaces libraries using two strategies:

  • Use Maven to compile/deploy your project. You can use it as well to generate a Richfaces project from a basic Archetype. This will be covered in another tutorial
  • Add manually Richfaces libraries and dependencies


In the next section we will show how to configure manually your libraries:

Configuring manually your Richfaces libs

If you want to configure manually Richfaces libraries in your project, you have to add to following jars in your WEB-INF/lib:

Library Where to find it
archiverichfaces-core-impl-4.X.X.Final.jar Richfaces core distribution
archiverichfaces-core-api-4.X.X.Final.jar Richfaces core distribution
archiverichfaces-components-ui-4.X.X.Final.jar Richfaces core distribution
archiverichfaces-components-api-4.X.X.Final.jar Richfaces core distribution
archivesac-1.3.jar Third-party lib. Get it here
archivecssparser-0.9.5.jar Third-party lib. Get it here
archiveguava-10.0.1.jar Third-party lib. Get it here

The last step is configuring your web.xml to map your URL pattern with the Faces Servlet and a bare bone faces-config.xml which states you are using JSF 2.0 specification.


Here's WEB-INF/web.xml

<?xml version="1.0" encoding="ASCII"?>
<web-app xmlns:xsi="" xmlns=""
    xmlns:web="" xsi:schemaLocation="" version="3.0">
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-name>Faces Servlet</servlet-name>

And your WEB-INF/faces-config.xml

<?xml version="1.0" encoding="UTF-8"?>