5 Replies Latest reply on Aug 19, 2008 1:01 PM by L Kr

    Can't generate ajax call from JSF page

    Gaurang Panchal Newbie

      I am using JBoss RichFaces Ajax4JSF functionality.

      I am making different ajax calls from the application. The problem is that that ajax call is working fine when i do it from individual jsf page.
      But, when i put that jsf page in the application flow(means, call that page from another jsf page), that ajax call is going to server and updates the bean data but it is not reRandering it on the jsf page.

      I have used,
      <a4j:commandButton id="cmdAjaxBack" action="#{testBean.prev}" value="Ajax Back" styleClass="button" reRender="currentGroup"/>
      to generate ajax call.
      Here, currentGroup is a id of the dataTable componeent.

      I don't know why it is behaving like this, probably, the call is not passing thorugh Ajax4JSF filter. But, how to make it to pass thorugh it.

      Please, reply as soon as possible, as i need to build functionality rapidly and i have stuck up on this issue.

        • 1. Re: Can't generate ajax call from JSF page
          L Kr Newbie

          I'm having the same problem but can't get it working even on a single page ;( But the sample I've found here seems to work: http://sezera.blogspot.com/2008/07/sample-springhibernatejsfrichfaces.html
          My xhtml-site looks like:

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          <html xmlns="http://www.w3.org/1999/xhtml"
          <f:loadBundle basename="resources.resource" var="bundle"/>
          <a4j:outputPanel ajaxRendered="true">
           <a4j:log popup="true" id="log_pop" level="ALL" style="width: 800px; height: 300px;"></a4j:log>
           <a4j:outputPanel ajaxRendered="true">
           <h:messages globalOnly="false" errorClass="errorMessage" infoClass="infoMessage" />
           <rich:messages />
          <a4j:region renderRegionOnly="true" id="inputGroup">
          <h:panelGrid id="ajaxdemo" columns="2" border="0" columnClasses="panelc" >
           <h:inputText id="myInput" value="#{authorizationController.myTestProperty}">
           <a4j:support id="myAjaxSupport" event="onkeyup" reRender="myOutput"></a4j:support>
           <h:outputText id="myOutput" forceId="true" border="2" value="#{authorizationController.myTestProperty}"></h:outputText>

          Tried it with the Sun JSF RI (Mojarra) and also MyFaces with different versions and browsers. I'm also using Spring and Hibernate.

          Thanks, Lothar

          • 2. Re: Can't generate ajax call from JSF page
            Sergey Smirnov Master

            I do not see the form on your page.

            • 3. Re: Can't generate ajax call from JSF page
              L Kr Newbie

              You're right. I've tried to simplify the page but I've tried it before and now again with a surrounding h:form with no luck ;(

              • 4. Re: Can't generate ajax call from JSF page
                L Kr Newbie

                Is there any known problem with Apache Tomahawk because I currently use it and can't remove it.

                • 5. Re: Can't generate ajax call from JSF page
                  L Kr Newbie

                  After hours and days of searching I've found the (?) solution. If I add the following part to my web.xml it works perfect:

                   <display-name>Ajax4jsf Filter</display-name>

                  Without it I get the described problems. Of course I have the rich faces filter defined.
                   <display-name>RichFaces Filter</display-name>
                   <servlet-name>Faces Servlet</servlet-name>

                  And no matter if the following part is enabled or not

                  So now it works but I don't now why ;)