RichFaces installing and configuration

RichFaces FAQ


 

RichFaces 3.3.x with Trinidad

 

Here is a stripped down version of web.xml that integrates RichFaces and Trinidad.

<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd" version="2.5">
     <!-- Ajax4jsf -->
     <context-param>
          <param-name>org.ajax4jsf.SKIN</param-name>
          <param-value>blueSky</param-value>
     </context-param>
     <!-- Seam -->
     <listener>
          <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
     </listener>
     <filter>
          <filter-name>Seam Filter</filter-name>
          <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
     </filter>
     <filter-mapping>
          <filter-name>Seam Filter</filter-name>
          <url-pattern>/*</url-pattern>
     </filter-mapping>
     <servlet>
          <servlet-name>Seam Resource Servlet</servlet-name>
          <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
     </servlet>
     <servlet-mapping>
          <servlet-name>Seam Resource Servlet</servlet-name>
          <url-pattern>/seam/resource/*</url-pattern>
     </servlet-mapping>
     <!-- Facelets -->
     <context-param>
          <param-name>facelets.DEVELOPMENT</param-name>
          <param-value>true</param-value>
     </context-param>
     <!-- JSF -->
     <context-param>
          <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
          <param-value>.xhtml</param-value>
     </context-param>
     <servlet>
          <servlet-name>Faces Servlet</servlet-name>
          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
     </servlet>
     <servlet-mapping>
          <servlet-name>Faces Servlet</servlet-name>
          <url-pattern>*.xhtml</url-pattern>
     </servlet-mapping>
     <context-param>
          <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
          <param-value>server</param-value>
     </context-param>
     <!-- Trinidad - as suggested by a4j-trinidad example-->
     <context-param>
          <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
          <param-value>com.sun.facelets.FaceletViewHandler</param-value>
     </context-param>
     <filter>
          <filter-name>Trinidad</filter-name>
          <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
     </filter>
     <filter-mapping>
          <filter-name>Trinidad</filter-name>
          <url-pattern>*.xhtml</url-pattern>
          <dispatcher>REQUEST</dispatcher>
          <dispatcher>FORWARD</dispatcher>
          <dispatcher>INCLUDE</dispatcher>
     </filter-mapping>
     <context-param>
          <param-name>org.apache.myfaces.trinidad.CACHE_VIEW_ROOT</param-name>
          <param-value>false</param-value>
     </context-param>
     <servlet>
          <servlet-name>Trinidad Resources</servlet-name>
          <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
     </servlet>
     <servlet-mapping>
          <servlet-name>Trinidad Resources</servlet-name>
          <url-pattern>/adf/*</url-pattern>
     </servlet-mapping>
     <!-- Security -->
     <security-constraint>
          <web-resource-collection>
               <web-resource-name>Secure Content</web-resource-name>
               <url-pattern>*.xhtml</url-pattern>
          </web-resource-collection>
          <auth-constraint>
               <role-name>AuthorizedUser</role-name>
          </auth-constraint>
          <user-data-constraint>
               <transport-guarantee>NONE</transport-guarantee>
          </user-data-constraint>
     </security-constraint>
     <login-config>
          <auth-method>BASIC</auth-method>
          <realm-name>The Restricted Zone</realm-name>
     </login-config>
     <security-role>
          <description>The role required to access restricted content</description>
          <role-name>AuthorizedUser</role-name>
     </security-role>
     <!-- Welcome files -->
     <welcome-file-list>
          <welcome-file>index.xhtml</welcome-file>
     </welcome-file-list>
</web-app>

 

 

Problems while launching the RichFaces sample on the JBoss server

 

The problems caused not directly by RichFaces but could be because application contains JSF libraries bundled. And jboss as also came with JSF implementation - so there is a place for conflicts. In that case  you need to add the following context parameter to your web.xml:

...
<context-param>
     <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
     <param-value>true</param-value>
</context-param>
...