2 Replies Latest reply on Oct 15, 2008 12:28 AM by Francisco Jose Peredo Noguez

    What's the correct web.xml?

    Thai Dang Vu Apprentice

      I'm using seam 2.1.0.CR1.
      The web.xml generated by seam-gen doesn't declare the Ajax4jsf filter as in the RichFaces demo. I didn't go any further with the generated web.xml because I'm still in the first few days of learning seam. When I added the Ajax4jsf filter to the web.xml like this, there were some exceptions org.ajax4jsf.resource.ResourceNotFoundException: Resource not registered.



      <?xml version="1.0" encoding="UTF-8"?>
      <web-app id="WebApp_ID" 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">
           <display-name>web-project</display-name>
           <context-param>
                <param-name>org.ajax4jsf.SKIN</param-name>
                <param-value>blueSky</param-value>
           </context-param>
           <context-param>
                <param-name>facelets.DEVELOPMENT</param-name>
                <param-value>true</param-value>
           </context-param>
           <context-param>
                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                <param-value>.xhtml</param-value>
           </context-param>
           <context-param>
                <param-name>com.sun.faces.validateXml</param-name>
                <param-value>true</param-value>
           </context-param>
           <context-param>
                <param-name>com.sun.faces.verifyObjects</param-name>
                <param-value>false</param-value>
           </context-param>
           <context-param>
                <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                <param-value>server</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>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
                <param-value>true</param-value>
           </context-param>
           <context-param>
                <param-name>org.ajax4jsf.COMPRESS_STYLE</param-name>
                <param-value>true</param-value>
           </context-param>
           <filter>
                <display-name>Ajax4jsf Filter</display-name>
                <filter-name>ajax4jsf</filter-name>
                <filter-class>org.ajax4jsf.Filter</filter-class>
                <init-param>
                     <param-name>createTempFiles</param-name>
                     <param-value>false</param-value>
                </init-param>
                <init-param>
                     <param-name>maxRequestSize</param-name>
                     <param-value>100000</param-value>
                </init-param>
           </filter>
      
           <filter>
                <filter-name>Seam Filter</filter-name>
                <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
           </filter>
           <filter-mapping>
                <filter-name>ajax4jsf</filter-name>
                <servlet-name>Faces Servlet</servlet-name>
                <dispatcher>FORWARD</dispatcher>
                <dispatcher>REQUEST</dispatcher>
                <dispatcher>INCLUDE</dispatcher>
                <dispatcher>ERROR</dispatcher>
           </filter-mapping>
           <filter-mapping>
                <filter-name>Seam Filter</filter-name>
                <url-pattern>/*</url-pattern>
           </filter-mapping>
           <listener>
                <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
           </listener>
           <servlet>
                <servlet-name>Faces Servlet</servlet-name>
                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
           </servlet>
           <servlet>
                <servlet-name>Seam Resource Servlet</servlet-name>
                <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
           </servlet>
           <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>*.seam</url-pattern>
           </servlet-mapping>
           <servlet-mapping>
                <servlet-name>Seam Resource Servlet</servlet-name>
                <url-pattern>/seam/resource/*</url-pattern>
           </servlet-mapping>
           <welcome-file-list>
                <welcome-file>index.html</welcome-file>
                <welcome-file>index.htm</welcome-file>
                <welcome-file>index.jsp</welcome-file>
                <welcome-file>default.html</welcome-file>
                <welcome-file>default.htm</welcome-file>
                <welcome-file>default.jsp</welcome-file>
           </welcome-file-list>
           <security-constraint>
                <display-name>Restrict raw XHTML Documents</display-name>
                <web-resource-collection>
                     <web-resource-name>XHTML</web-resource-name>
                     <url-pattern>*.xhtml</url-pattern>
                </web-resource-collection>
                <auth-constraint />
           </security-constraint>
           <login-config>
                <auth-method>BASIC</auth-method>
           </login-config>
      </web-app>



      If adding ajax4jsf filter is a correct thing, should that filter appear before or after the Seam Filter?