5 Replies Latest reply on Nov 13, 2006 6:25 PM by Gavin King

    Ajax4jsf does no work

    Michael Schuetz Newbie

      Hi,

      i'm using seam, facelets, ajax4jsf and myfaces - all in latest versions.

      Following Code does NOT work in my Seam-Application - that means that the page appears but does nothing (asynchronously!) when triggering an event.

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core">
      
      <body>
      <ui:composition template="/templates/defaultTemplate.xhtml">
      
       <ui:define name="siteTitle">
       Ajax Test
       </ui:define>
      
       <ui:define name="body">
      
       <f:view>
       <h:form>
       <a4j:region selfRendered="true">
       <h:panelGrid columns="2">
      
       <h:outputText value="Type the Text:" />
       <h:inputText value="#{useraccount.userName}">
       <a4j:support event="onkeyup" reRender="repeater" />
       </h:inputText>
      
       <h:outputText value="Text in the AJAX Response:" />
       <h:outputText id="repeater" value="#{useraccount.userName}" />
      
       </h:panelGrid>
       </a4j:region>
       </h:form>
      
       </f:view>
      
       </ui:define>
      
      </ui:composition>
      
      </body>
      
      </html>
      


      In a non-seam application all works fine.

      Do you have an idea? Thanks

        • 1. Re: Ajax4jsf does no work
          Michael Schuetz Newbie

          The web.xml:

          <?xml version="1.0"?>
          <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">
          
           !-- other faces configuration files -->
           <context-param>
           <param-name>javax.faces.CONFIG_FILES</param-name>
           <param-value>/WEB-INF/navigation.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>facelets.REFRESH_PERIOD</param-name>
           <param-value>2</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.STATE_SAVING_METHOD</param-name>
           <param-value>client</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>true</param-value>
           </context-param>
           <context-param>
           <param-name>org.jboss.seam.core.init.debug</param-name>
           <!-- when true, seam will catch exceptions and shows debug page -->
           <param-value>false</param-value>
           </context-param>
           <filter>
           <filter-name>Seam Redirect Filter</filter-name>
           <filter-class>
           org.jboss.seam.servlet.SeamRedirectFilter
           </filter-class>
           </filter>
           <filter>
           <filter-name>Seam Exception Filter</filter-name>
           <filter-class>
           org.jboss.seam.servlet.SeamExceptionFilter
           </filter-class>
           </filter>
          
           <!-- filter for ajax4jsf -->
           <filter>
           <display-name>Ajax4jsf Filter</display-name>
           <filter-name>ajax4jsf</filter-name>
           <filter-class>org.ajax4jsf.Filter</filter-class>
           </filter>
          
           <filter-mapping>
           <filter-name>ajax4jsf</filter-name>
           <servlet-name>Faces Servlet</servlet-name>
           <dispatcher>REQUEST</dispatcher>
           <dispatcher>FORWARD</dispatcher>
           <dispatcher>INCLUDE</dispatcher>
           </filter-mapping>
           <listener>
           <listener-class>
           org.jboss.seam.servlet.SeamListener
           </listener-class>
           </listener>
           <listener>
           <listener-class>
           org.apache.myfaces.webapp.StartupServletContextListener
           </listener-class>
           </listener>
          
           <!-- Faces Servlet -->
           <servlet>
           <servlet-name>Faces Servlet</servlet-name>
           <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
           <load-on-startup>1</load-on-startup>
           </servlet>
          
           <!-- Faces Servlet Mapping -->
           <servlet-mapping>
           <servlet-name>Faces Servlet</servlet-name>
           <url-pattern>*.jsf</url-pattern>
           </servlet-mapping>
          
           <!-- welcome file -->
           <welcome-file-list>
           <welcome-file>index.html</welcome-file>
           </welcome-file-list>
           <login-config>
           <auth-method>BASIC</auth-method>
           </login-config>
          </web-app>
          
          


          • 2. Re: Ajax4jsf does no work
            anti spart Newbie

            I'm having a similar issue. <a:outputPanel> only reRenders if I set ajaxRendered="true"

            Just tried a seam example from CVS and it looks to work so I'm a little lost for a reason for my app not working.

            • 4. Re: Ajax4jsf does no work
              Gavin King Master

              Y'know, Todd and myself put a lot of work into building a nice example application that shows exactly how to use Ajax4JSF with Seam. Please follow the example, since otherwise you waste your time, my time, and everyone else here's time. Sheesh.

              • 5. Re: Ajax4jsf does no work
                Gavin King Master

                This is how you use Ajax4JSF with Facelets:

                <context-param>
                 <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                 <param-value>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</param-value>
                 </context-param>


                (copy/pasted straight from the Seam 1.1 booking example)