7 Replies Latest reply on Nov 20, 2008 8:52 PM by Nick Belaevski

    Richfaces Component in Struts 2

    Kamlesh Patel Newbie

      Can I use Richfaces components in Struts 2 application.

      I have download one test application with Richface in Struts 2 using interceptors. But it not working as desire. There is no errors in log file but out put in browser is not expected with java scripting errors.

      Using Environment.
      - Tomcat 6.0
      - Java 1.5
      - Struts 2
      - JSF 1.2
      - Richfaces 3.2.1

      Any guess???

        • 1. Re: Richfaces Component in Struts 2
          Nick Belaevski Master

          Hello,

          Please post your web.xml file

          • 2. Re: Richfaces Component in Struts 2
            Kamlesh Patel Newbie

            Web.xml file

            <?xml version="1.0" encoding="iso-8859-1" ?>

            <web-app>
            <display-name>Application</display-name>

            <!-- Struts 2 -->

            <filter-name>struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
            <init-param>
            <param-name>actionPackages</param-name>
            <param-value>struts2.action</param-value>
            </init-param>


            <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/*</url-pattern>
            </filter-mapping>


            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>


            <!-- JavaServer Faces Servlet Configuration, not used directly -->

            <servlet-name>faces</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>


            <servlet-name>JspSupportServlet</servlet-name>
            <servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
            <load-on-startup>1</load-on-startup>


            <!-- JavaServer Faces Servlet Mapping, not called directly -->
            <servlet-mapping>
            <servlet-name>faces</servlet-name>
            <url-pattern>*.action</url-pattern>
            </servlet-mapping>

            <!-- RichFaces -->
            <context-param>
            <param-name>org.richfaces.SKIN</param-name>
            <param-value>deepMarine</param-value>
            </context-param>


            <display-name>RichFaces Filter</display-name>
            <filter-name>richfaces</filter-name>
            <filter-class>org.ajax4jsf.Filter</filter-class>


            <filter-mapping>
            <filter-name>richfaces</filter-name>
            <servlet-name>faces</servlet-name>
            REQUEST
            FORWARD
            INCLUDE
            </filter-mapping>


            <listener-class>com.sun.faces.config.ConfigureListener</listener-class>


            <context-param>
            <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
            <param-value>com.sun.facelets.FaceletViewHandler</param-value>
            </context-param>

            <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>server</param-value>
            </context-param>

            <!-- The Usual Welcome File List -->
            <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            </welcome-file-list>

            </web-app>

            Thanks
            Kamlesh

            • 3. Re: Richfaces Component in Struts 2
              Kamlesh Patel Newbie


              Please Advise..
              As I want to start new project in struts 2 but I want to use some
              Richfaces component.

              I want to know is it possible??.

              Thanks

              • 5. Re: Richfaces Component in Struts 2
                Nick Belaevski Master

                Hi,

                Configure aplication as follows:

                <?xml version="1.0" encoding="iso-8859-1"?>
                <web-app version="2.4" 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_4.xsd">
                 <display-name>Application</display-name>
                 <context-param>
                 <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                 <param-value>.xhtml</param-value>
                 </context-param>
                 <!-- RichFaces -->
                 <context-param>
                 <param-name>org.richfaces.SKIN</param-name>
                 <param-value>deepMarine</param-value>
                 </context-param>
                 <context-param>
                 <param-name>contextConfigLocation</param-name>
                 <param-value>classpath*:applicationContext-*.xml</param-value>
                 </context-param>
                 <context-param>
                 <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                 <param-value>com.sun.facelets.FaceletViewHandler</param-value>
                 </context-param>
                 <context-param>
                 <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                 <param-value>server</param-value>
                 </context-param>
                 <filter>
                 <display-name>RichFaces Filter</display-name>
                 <filter-name>richfaces</filter-name>
                 <filter-class>org.ajax4jsf.Filter</filter-class>
                 </filter>
                 <!-- Struts 2 -->
                 <filter>
                 <filter-name>struts2</filter-name>
                 <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
                 </filter>
                 <filter-mapping>
                 <filter-name>richfaces</filter-name>
                 <servlet-name>faces</servlet-name>
                 </filter-mapping>
                 <filter-mapping>
                 <filter-name>struts2</filter-name>
                 <url-pattern>/*</url-pattern>
                 </filter-mapping>
                 <listener>
                 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
                 </listener>
                 <listener>
                 <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
                 </listener>
                 <!-- JavaServer Faces Servlet Configuration, not used directly -->
                 <servlet>
                 <servlet-name>faces</servlet-name>
                 <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                 <load-on-startup>1</load-on-startup>
                 </servlet>
                 <servlet>
                 <servlet-name>JspSupportServlet</servlet-name>
                 <servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
                 <load-on-startup>1</load-on-startup>
                 </servlet>
                 <!-- JavaServer Faces Servlet Mapping, not called directly -->
                
                 <servlet-mapping>
                 <servlet-name>faces</servlet-name>
                 <url-pattern>*.action</url-pattern>
                 </servlet-mapping>
                
                 <servlet-mapping>
                 <servlet-name>faces</servlet-name>
                 <url-pattern>/faces/*</url-pattern>
                 </servlet-mapping>
                
                 <!-- The Usual Welcome File List -->
                 <welcome-file-list>
                 <welcome-file>index.html</welcome-file>
                 </welcome-file-list>
                 <login-config>
                 <auth-method>BASIC</auth-method>
                 </login-config>
                </web-app>
                and it will work

                • 6. Re: Richfaces Component in Struts 2
                  Kamlesh Patel Newbie

                  Hi Thanks for reply.

                  It still not working now giving me error 404 error as teste.action is not available.

                  Here I am using struts action controller so no face-config file in my application

                  Thanks
                  Kamlesh

                  • 7. Re: Richfaces Component in Struts 2
                    Nick Belaevski Master

                    Kamlesh,

                    I'm almost newbie in Struts 2. Can you please check Maven project attached to: https://jira.jboss.org/jira/browse/RF-4984 and tell how should I change it to reproduce the problem?