RichFaces Application

application

In this topic, we will discuss the application in Rich Faces.

1) After adding JARs, create a JavaServer Faces project and integrate this library to the project.

application

Selecting project type as Web Application.

application

Providing project name.

application

Selecting Framework as JavaServer Faces.

2) Now select library that we have created earlier in the example.

application

After finishing, Our project structure should look like the following.

application

Well, it is all about configration. There is nothing we actually need to do to configure RichFaces. If we look inside the web.xml file in the generated project, we will see no mention of a RichFaces filter. Starting with RichFaces 4, we don’t need to register a filter in the web.xml ?le. If RichFaces JARs are present in the project, RichFaces will be used.

This project contains two default xhtml files. First is index.xhtml and second is welcomeRichfaces.xhtml. These two files have the following code.

// index.xhtml

<?xml version='1.0' encoding='UTF-8' ?>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml"  
xmlns:h="http://xmlns.jcp.org/jsf/html">  
<h:head>  
<title>Facelet Title</title>  
</h:head>  
<h:body>  
Hello from Facelets  
<br />  
<h:link outcome="welcomeRichfaces" value="Richfaces welcome page" />  
</h:body>  
</html>  

// welcomeRichfaces.xhtml

<?xml version='1.0' encoding='UTF-8' ?>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml"  
xmlns:rich="http://richfaces.org/rich"  
xmlns:h="http://java.sun.com/jsf/html">  
<h:head>  
<title>Richfaces Welcome Page</title>  
</h:head>  
<h:body>  
<rich:panel header="Welcome to Richfaces">  
RichFaces is an advanced UI component framework for easily integrating Ajax capabilities into business   
applications using JSF.  Check out the links below to lear more about using RichFaces in your application.  
<ul>  
<li><h:outputLink value="http://richfaces.org">Richfaces Project Home Page  
</h:outputLink></li>  
<li><h:outputLink value="http://showcase.richfaces.org">Richfaces Showcase  
</h:outputLink></li>  
<li><h:outputLink value="https://community.jboss.org/en/richfaces?view=discussions">User Forum  
</h:outputLink></li>  
<li><h:outputLink value="http://www.jboss.org/richfaces/docs">Richfaces documentation...  
</h:outputLink>  
<ul>  
<li><h:outputLink   
value="http://docs.jboss.org/richfaces/latest_4_X/Developer_Guide/en-US/html_single/">Development Guide  
</h:outputLink></li>  
<li><h:outputLink   
value="http://docs.jboss.org/richfaces/latest_4_X/Component_Reference/en-US/html/">Component Reference  
</h:outputLink></li>  
<li><h:outputLink value="http://docs.jboss.org/richfaces/latest_4_X/vdldoc/">Tag Library Docs  
</h:outputLink></li>  
</ul>  
</li>  
</ul>  
</rich:panel>  
</h:body>  
</html>  

3) Run the project

After running the index.xhtml file. It produces the following output:

After clicking on the link, it redirects to the welcomeRichfaces page.

application

Next Topic:-Click Here

Leave a Reply