Installing RichFaces is very easy.
Download the latest RichFaces version from http://www.jboss.org/jbossrichfaces/ .
Add three RichFaces JAR files to your application WEB-INF/lib directory:
RichFaces also depends on the following libraries: commons-beanutils.jar, commons-collections.jar, commons-digester.jar, commons-logging.jar
As of the writing of this article, the latest RichFaces version is 3.3.0 .
Note: to use Hibernate Validation, additional JAR files are needed. The JAR files are included in the project.
Register the RichFaces filter in a web.xml file:
Optionally, to use one of the existing skins, add the following:
Note: new skins such as laguna, glassX and darkX are available in their own separate JAR files.
If you are using Facelets, then add this to your page:
Just in case you are still stuck with JSPs, you would then add this to your pages:
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
A little bit further in this article, I have created a ready-to-use Eclipse project with RichFaces and Spring already configured. We are going to import the project into Eclipse and then start development. In the “real” world, you would probably use Maven 2, but, to keep things simple and concentrate on RichFaces and Spring, we are going to use a ready-made project.
Not to repeat what has been said about Spring in numerous great articles and other resources, I will not list every Spring feature. You can find numerous resources on the Internet. Simply stated, Spring is a framework that greatly simplifies enterprise Java development.
The part that's of interest to us here is Spring beans and injection of control (there's a great article on it here ). Spring is often a great candidate for a middle tier in a Web application. While JSF offers us managed beans and basic dependency injection, Spring's dependency injection is much more powerful. Why use two containers (JSF and Spring) to manage beans when you can use just one?
As I mentioned at the beginning, I will show you two ways to configure Spring beans. One is XML-based and the other is annotation-based. Even the XML-based configuration significantly reduces the amount of XML you have to write compared to the XML configuration of JSF managed beans.