4 Replies Latest reply on Aug 31, 2007 3:36 PM by ericomtx

    Ajax4JSF and Facelets

    ericomtx Newbie

      I'm trying to use ajax4jsf with facelets

      In a user.xhtml file I have :

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <t:document xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:sh="http://shale.apache.org/core"
      xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
      xmlns:t="http://myfaces.apache.org/tomahawk">

      <ui:composition template="/template/template.xhtml">

      In my template.xhtml I have a4jsf declared too

      In my user.xhtml I tryied to implement an example :

      ...
      <a4j:region id="stat1">
      ...
      <h:inputText id="usr">
      <a4j:support event="onkeyup" />
      </h:inputText>
      <a4j:status startText=" Performing Request"
      stopText=" Request Done" for="stat1">
      </a4j:status>
      ...
      </a4j:region>
      ...

      When I digit something in the inputText I get the following error in my browser :

      A4J is not defined

        • 1. Re: Ajax4JSF and Facelets
          Sergey Smirnov Master

          may be you have no filter declared in the web.xml

          • 2. Re: Ajax4JSF and Facelets
            ericomtx Newbie

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


            <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>
            <url-pattern>*.jsf</url-pattern>
            REQUEST
            FORWARD
            INCLUDE
            </filter-mapping>

            I have other filters from shale and MyFaces declared in my web.xml
            Could one of them or their properties as mapping intervene in ajax4jsf filter ?

            • 3. Re: Ajax4JSF and Facelets
              Sergey Smirnov Master

              In general, "A4J is not defined" means the javascript is not loaded. The script is generated by filter. For myFaces, you need to have a a4j:page tag declared right after f:view. If you do not, it might be the problem. You declare that only *.jsf are comes thru the filter. So, if the particular pages does not, it also might be the problem.
              The earlier version of shale used to have bug that causes the problem of integration. However, I did not see about any conflict for long period of time.
              Search the Internet for the proven web.xml declaration. If I remember correctly, MyFaces wiki has something like that.

              • 4. Re: Ajax4JSF and Facelets
                ericomtx Newbie

                The problem was the integration with Shale

                I was using the 1.0.4 and changed to 1.0.3 as you said

                It's working ok now

                Thanks !!!