Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RichFaces 3.3.3 with JSF 2.0 working example

I'm very new to JSF and i'm looking for a pure configuration of JSF 2.0 with RichFaces 3.3.3.Final. The documentation on JBoss website is for JSF 1.2. I also find this jboss article but the sample application has a lot of configurations.

If you have successfully made RichFaces and JSF 2 work, please share you config. Thank you.

like image 486
robinmag Avatar asked Aug 14 '10 14:08

robinmag


3 Answers

You have to add the latest facelets, richfaces 3.3.3 and jsf 2.x libraries. this is my web.xml config i'm using for my project:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Production</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>/faces/*</url-pattern>
    </servlet-mapping>
    <context-param>
        <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
        <param-value>true</param-value>
    </context-param>

    <!--Configuration for Richfaces-->
    <filter>
        <display-name>RichFaces Filter</display-name>
        <filter-name>richfaces</filter-name>
        <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>richfaces</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    <!--End of the configuration part for Richfaces-->

    <!--Configuration for Facelets-->
    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.jsp</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.VIEW_MAPPINGS</param-name>
        <param-value>*.xhtml</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>
    <!--End of the configuration part for Facelets-->


    <welcome-file-list>
        <welcome-file>faces/index.jsp</welcome-file>
    </welcome-file-list>


</web-app>

and this is what you can find on my library: standard.jar (for JSTL)

jstl.jar (for JSTL)

jsf-facelets.jar (Facelets 1. 1. 15)

richfaces-api-3.3.3.Final.jar

richfaces-impl-jsf2-3.3. 3.Final.jar

richfaces-ui-3.3.3.Final.jar

commons-beanutils-1.8.3.jar

commons-collections-3.2. 1.jar

commons-digester-2.0.jar

commons-logging-1.1.1.jar

jsf-api.jar (for JSF2)

jsf-impl.jar(for JSF2)

HTH.

like image 71
mohamida Avatar answered Oct 15 '22 02:10

mohamida


You can try this RichFaces 4 template for Tomcat 6: http://mkblog.exadel.com/2010/06/richfaces-4-alpha-2-is-now-available-project-template/ . Just replace the alpha version with M1 version. Also, starting with RichFaces 4, there is zero configuration.

like image 33
Max Katz Avatar answered Oct 15 '22 04:10

Max Katz


What exactly is the problem you have? Lot of configurations? A too huge web.xml? Well, that's what you get for it. Either just follow the documentation carefully - it's clear enough, or just look for another component library which require less configuration, like PrimeFaces. Basically all you need to add is a single resource servlet.

If you want more assistance in getting RichFaces to work, you'll really need to be more clear about the actual problem. "Lot of configurations" isn't a technical problem. It's between your ears. Error/warning messages and odd symptoms are real problems. You should elaborate about that instead.

like image 41
BalusC Avatar answered Oct 15 '22 03:10

BalusC