8 Replies Latest reply on Apr 28, 2008 6:14 PM by Sergey Smirnov

    moving from jsf 1.1 to richfaces 3.2.0.GA

    Ravi M Newbie

      I currently have an application implemented in jsf 1.1. I started porting to richfaces 3.2.0.GA with jsf 1.2_04-b16-p02 version jar files. My aim is to have some pages of the application still run as *.faces and some with *.xhtml extension (e.g. treeView.xhtml)

      pages with .faces extension work fine, but pages with .xhtml extension throw exception. when i do a http query for treeView.xhtml, it throws an 404 exception for treeView.jsp.

      My web.xml

      <?xml version="1.0"?>

      <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">
      <context-param>
      <param-name>com.sun.faces.expressionFactory</param-name>
      <param-value>org.apache.el.ExpressionFactoryImpl</param-value>
      </context-param>

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

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



      <servlet-name>AJAXServlet</servlet-name>
      <servlet-class>net.em.servlets.AJAXServlet</servlet-class>
      <load-on-startup>1</load-on-startup>



      <servlet-name>InitialLizeApplicationbeansServlet</servlet-name>
      <servlet-class>net.em.servlets.InitialLizeApplicationBeanServlet</servlet-class>
      <load-on-startup>1</load-on-startup>


      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.faces</url-pattern>
      </servlet-mapping>

      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>/treeView.xhtml</url-pattern>
      </servlet-mapping>

      <servlet-mapping>
      <servlet-name>AJAXServlet</servlet-name>
      <url-pattern>/abc.ajax</url-pattern>
      </servlet-mapping>


      <filter-name>ExtensionsFilter</filter-name>
      <filter-class>
      net.em.emrp.filters.EMExtensionsFilter
      </filter-class>
      <init-param>
      <param-name>uploadMaxFileSize</param-name>
      <param-value>10m</param-value>
      </init-param>
      <init-param>
      <param-name>uploadThresholdSize</param-name>
      <param-value>100k</param-value>
      </init-param>



      <filter-name>ResponseOverrideFilter</filter-name>
      <filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>


      <session-config>
      <session-timeout>
      720 <!-- minutes -->
      </session-timeout>
      </session-config>

      <filter-mapping>
      <filter-name>ExtensionsFilter</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      </filter-mapping>

      <filter-mapping>
      <filter-name>ResponseOverrideFilter</filter-name>
      <url-pattern>*.do</url-pattern>
      </filter-mapping>
      <filter-mapping>
      <filter-name>ResponseOverrideFilter</filter-name>
      <url-pattern>*.jsp</url-pattern>
      </filter-mapping>


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


      <filter-mapping>
      <filter-name>ajax4jsf</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      REQUEST
      FORWARD
      INCLUDE
      </filter-mapping>

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


      <taglib-uri>http://ajaxtags.org/tags/ajax</taglib-uri>
      <taglib-location>/WEB-INF/ajaxtags.tld</taglib-location>

      </web-app>

        • 1. Re: moving from jsf 1.1 to richfaces 3.2.0.GA
          Ravi M Newbie

          I also see the following line in my catalina.out

          INFO: JSF1027: [/loginx] The ELResolvers for JSF were not registered with the JSP container.

          Not sure, if it is related.

          Thanks in advance

          • 2. Re: moving from jsf 1.1 to richfaces 3.2.0.GA
            Sergey Smirnov Master

            What is you Servlet container?
            Do you use Facelets ot not?

            • 3. Re: moving from jsf 1.1 to richfaces 3.2.0.GA
              Ravi M Newbie

              we dont use Facelets. I guess, we use basic jsf servlet container


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

              • 4. Re: moving from jsf 1.1 to richfaces 3.2.0.GA
                Sergey Smirnov Master

                What is your servlet container (Tomcat 5.0, Tomcat 5.5, Jboss App Serv, etc)?

                • 5. Re: moving from jsf 1.1 to richfaces 3.2.0.GA
                  Ravi M Newbie

                  tomcat 6.0.6

                  • 6. Re: moving from jsf 1.1 to richfaces 3.2.0.GA
                    Sergey Smirnov Master

                    Ok. You are still far away from the successful porting.

                    <servlet-mapping>
                    <servlet-name>Faces Servlet</servlet-name>
                    <url-pattern>/treeView.xhtml</url-pattern>
                    </servlet-mapping>


                    This is invalid mapping. The * must be there.

                    What is inside this treeView.xhtml?

                    your web.xml says web-app version 2.4. It is better to have 2.5 there

                    Not sure 1.2_04 understands tomcat 6.0.6 like a true JSP 2.1 container. Search internet for more info.

                    • 7. Re: moving from jsf 1.1 to richfaces 3.2.0.GA
                      Ravi M Newbie

                      Thanks for the quick reply.

                      I still get the same error, with the following changes

                      I changed to

                      <servlet-mapping>
                       <servlet-name>Faces Servlet</servlet-name>
                       <url-pattern>*.xhtml</url-pattern>
                       </servlet-mapping>
                      


                      also, changed version of web-apps to 2.5

                      <web-app version="2.5" 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">
                      



                      treeView.xhtml has the following code

                      <!-- <?xml version="1.0" encoding="UTF-8"?> -->
                      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                      <html
                       xmlns="http://www.w3.org/1999/xhtml"
                       xmlns:jsp="http://java.sun.com/JSP/Page"
                       xmlns:h="http://java.sun.com/jsf/html"
                       xmlns:f="http://java.sun.com/jsf/core"
                       xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
                       xmlns:c="http://java.sun.com/jstl/core"
                       xmlns:rich="http://richfaces.ajax4jsf.org/rich">
                      
                      <h:form>
                       <rich:tree style="width:300px" id="testTree" var="myTree" switchType="server" treeNodeVar="treeNode"
                       value="#{treeBean.treeNew}" >
                      
                       <rich:treeNode icon="/images/item.png" >
                       <h:outputText value="#{treeNode.label} #{myTree.childCount}" />
                       </rich:treeNode>
                       </rich:tree>
                      
                       <h:outputText value="#{treeBean.totalNodes}" />
                      </h:form>
                      </html>
                      


                      • 8. Re: moving from jsf 1.1 to richfaces 3.2.0.GA
                        Sergey Smirnov Master

                        Your treeView.xhtml presumes you use Facelets view handlers. However, as you mentioned previously, you do not use facelets. So, you have no any chance to have it working.

                        Why do you want to have xhtml pages if you have existing application what use the standard JSP view handler? RichFaces does not require it.