9 Replies Latest reply on Jul 25, 2008 2:55 AM by nfeybesse

    Ajax Request never stops in some case

    nfeybesse

      In this example, test1 and test2 never stops. test0, test3 works ...
      I think that what you send should be independent of what you receive in Ajax Requests.
      In test1 and test2, the region disappears and Ajax Request never stops.
      Is causes many problems in my application.
      Is it normal or is it a bug ?

      <!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:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a="http://richfaces.org/a4j"
       xmlns:c="http://java.sun.com/jstl/core">
      
      <head>
      </head>
      
      <body>
      <f:view>
       <h:panelGrid id="panelGrid">
       <a:status id="commonstatus" startText="In progress..."
       stopText="Complete" />
       <h:form>
       <a:region immediate="true">
       <c:if test="#{testRegion.rendered}">
       <a:commandButton action="#{testRegion.setRendered(false)}"
       value="test0" reRender="panelGrid" status="commonstatus" />
       </c:if>
       </a:region>
       </h:form>
       <h:form>
       <c:if test="#{testRegion.rendered}">
       <a:region immediate="true">
       <a:commandButton action="#{testRegion.setRendered(false)}"
       value="test1" reRender="panelGrid" status="commonstatus" />
       </a:region>
       </c:if>
       </h:form>
       <c:if test="#{testRegion.rendered}">
       <h:form>
       <a:region immediate="true">
       <a:commandButton action="#{testRegion.setRendered(false)}"
       value="test2" reRender="panelGrid" status="commonstatus" />
       </a:region>
       </h:form>
       </c:if>
       <h:form>
       <c:if test="#{testRegion.rendered}">
       <a:commandButton action="#{testRegion.setRendered(false)}"
       value="test3" reRender="panelGrid" status="commonstatus" />
       </c:if>
       </h:form>
      
      
       <h:form>
       <a:commandButton action="#{testRegion.setRendered(true)}"
       value="initialize" reRender="panelGrid" status="commonstatus" />
       </h:form>
       </h:panelGrid>
      </f:view>
      </body>
      
      </html>


      and bean code :

      @Name("testRegion")
      @Scope(ScopeType.SESSION)
      public class TestRegion {
       boolean rendered=true;
      
       public boolean isRendered() {
       return rendered;
       }
      
       public void setRendered(boolean rendered) {
       this.rendered = rendered;
       }
      }


        • 1. Re: Ajax Request never stops in some case
          ilya_shaikovsky

          1) why hyou using c:if instead of just rendered attribute?

          2) imeediate attribute has no sence for region and should be hidden

          3) which version you've using?

          • 2. Re: Ajax Request never stops in some case
            nfeybesse

            Thanks for your answer

            I can't use rendered attribute ! In my application, It is more complex, I am using in fact a dynamic c:foreach with ui:include inside...
            Here is just a simple example to show the problem.

            ok for the immediate attribute... It does not change anything.

            Versions : Richfaces 3.2.2 SNAPSHOT, JSF 1.2_09 beta1, Seam 2.0.3 SNAPSHOT, Facelet 1.1.14.

            • 3. Re: Ajax Request never stops in some case
              nfeybesse

              Could you help me ?
              Is the problem difficult to patch ?

              Thanks in advance

              • 4. Re: Ajax Request never stops in some case
                ilya_shaikovsky

                please check also a4j:log info for non working requests.

                And take into consideration that jstl tags evaluated on page build not on page render phase.

                • 5. Re: Ajax Request never stops in some case
                  nfeybesse

                  I know that jstl tags are evaluated on build page and not on render phase. I don't believe this is really the problem here, because without region, all is ok.

                  For me, if a region is inside a c:if and disappears during an ajax Request, then the ajax request never stops.

                  With a form, no problem. it can disappear during request...

                  A region defines "what is send". It should not affect what is rendered, no ?

                  I have refactored the example to show the problem better.


                  I give you the a4j:log for test3 too, maybe it can help you to understand the problem.

                  <!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:h="http://java.sun.com/jsf/html"
                   xmlns:f="http://java.sun.com/jsf/core"
                   xmlns:a="http://richfaces.org/a4j"
                   xmlns:c="http://java.sun.com/jstl/core"
                   xmlns:rich="http://richfaces.org/rich">
                  
                  <head>
                  </head>
                  
                  <body>
                  <f:view>
                   <h:panelGrid>
                   <a:status id="commonstatus" startText="In progress..."
                   stopText="Complete" />
                  
                   <!-- test0 OK : no region, button disappears during request -->
                   <rich:panel id="panel0">
                   <h:form>
                   <c:if test="#{testRegion.rendered}">
                   <a:commandButton action="#{testRegion.setRendered(false)}"
                   value="test0" reRender="panel0" status="commonstatus" />
                   </c:if>
                   </h:form>
                   </rich:panel>
                  
                   <!-- test1 KO : region and button disappear during request -->
                   <rich:panel id="panel1">
                   <h:form>
                   <c:if test="#{testRegion.rendered}">
                   <a:region>
                   <a:commandButton action="#{testRegion.setRendered(false)}"
                   value="test1" reRender="panel1" status="commonstatus" />
                   </a:region>
                   </c:if>
                   </h:form>
                   </rich:panel>
                  
                  
                   <!-- test2 OK : no region, form and button disappear during request -->
                   <rich:panel id="panel2">
                   <c:if test="#{testRegion.rendered}">
                   <h:form>
                   <a:commandButton action="#{testRegion.setRendered(false)}"
                   value="test2" reRender="panel2" status="commonstatus" />
                   </h:form>
                   </c:if>
                   </rich:panel>
                  
                   <!-- test3 KO : form, region and button disappear during request -->
                   <rich:panel id="panel3">
                   <c:if test="#{testRegion.rendered}">
                   <h:form>
                   <a:region>
                   <a:commandButton action="#{testRegion.setRendered(false)}"
                   value="test3" reRender="panel3" status="commonstatus" />
                   </a:region>
                   </h:form>
                   </c:if>
                   </rich:panel>
                  
                  
                  
                   <!-- initialize -->
                   <h:form>
                   <a:commandButton action="#{testRegion.setRendered(true)}"
                   value="initialize" reRender="panel0,panel1,panel2,panel3"
                   status="commonstatus" />
                   </h:form>
                   </h:panelGrid>
                  
                   <a:log popup="false" level="ALL" style="width: 800px; height: 800px;"></a:log>
                  </f:view>
                  </body>
                  
                  </html>



                  and a4j:log for test 3 :

                  debug[18:50:46,140]: Have Event [object Object] with properties: target: [object HTMLInputElement], srcElement: undefined, type: click
                  debug[18:50:46,140]: NEW AJAX REQUEST !!! with form :j_id10
                  debug[18:50:46,140]: parameter j_id10:j_id12 with value j_id10:j_id12
                  debug[18:50:46,140]: Append hidden control j_id10 with value [j_id10] and value attribute [j_id10]
                  debug[18:50:46,140]: Append hidden control javax.faces.ViewState with value [j_id2] and value attribute [j_id2]
                  debug[18:50:46,156]: Start XmlHttpRequest
                  debug[18:50:46,156]: Reqest state : 1
                  debug[18:50:46,156]: QueryString: AJAXREQUEST=j_id10%3Aj_id11&j_id10%3Aj_id12=j_id10%3Aj_id12&j_id10=j_id10&javax.faces.ViewState=j_id2&
                  debug[18:50:46,156]: Reqest state : 1
                  debug[18:50:46,312]: Reqest state : 2
                  debug[18:50:46,312]: Reqest state : 4
                  debug[18:50:46,312]: Reqest end with state 4
                  debug[18:50:46,312]: Response with content-type: application/xhtml+xml;charset=UTF-8
                  debug[18:50:46,312]: Full response content:
                  debug[18:50:46,312]: Header Ajax-Response not found, search in <meta>
                  debug[18:50:46,312]: Header Ajax-Expired not found, search in <meta>
                  warn[18:50:46,312]: No ajax response header
                  debug[18:50:46,312]: Header Location not found, search in <meta>
                  warn[18:50:46,312]: No content in response for replace current page


                  I can't really use regions in my application and I can't benefit of a partial validation. Could you tell me if this problem has a chance to be patch in the future ?

                  Thanks in advance.

                  To have a look to our work: http://www.genericsystem.com

                  • 6. Re: Ajax Request never stops in some case
                    nfeybesse

                    Apparently it is a server side problem because the server response is empty when a region disappears.
                    Can someone tell me if it is normal ?

                    Thanks

                    • 7. Re: Ajax Request never stops in some case
                      abelevich

                      Hi, seems this is our bug...

                      https://jira.jboss.org/jira/browse/RF-3975

                      • 8. Re: Ajax Request never stops in some case
                        nfeybesse

                        oh !
                        Thanks my friend !

                        • 9. Re: Ajax Request never stops in some case
                          nfeybesse

                          Tested
                          All is ok now

                          Thanks