9 Replies Latest reply on Mar 3, 2009 9:57 AM by ronanker

    Regression 3.3.0 ? Bug after upgrade: action not executed wh

    ronanker

      hello,

      i upgrade from 3.2.1 (works also with 3.2.2) to 3.3.0.
      Some a4j:commandLink no longer works (also some suggestBox and menuItems).

      Here is a simple case where i can reproduce the bug. Each links with "ajaxSingle" don't works, they don't call 'action' and dont set 'actionParam'.

      <%@ page contentType="text/html;charset=UTF-8"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
      <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
      <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
      <HTML>
       <f:view>
       <head>
       <title>test</title>
       <meta http-equiv="pragma" content="no-cache" />
       <meta http-equiv="cache-control" content="no-cache" />
       <meta http-equiv="expires" content="0" />
       <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
       </head>
       <body>
       <a4j:status id="status" startText="ajax" stopText="iddle" />
       <t:aliasBean alias="#{aliasHandler}" value="#{handler}">
       <%--h:form id="formPage" rendered="#{handler.ressourceSelectionnee}"--%>
       <h:form id="formPage" rendered="#{aliasHandler.ressourceSelectionnee}">
      
       <h:panelGrid columns="10">
       <a4j:commandLink value="Page 1 (action)"
       action="#{aliasHandler.onClickGoPage1}"
       reRender="result"
       immediate="true">
       </a4j:commandLink>
       <a4j:commandLink value="Page 1 (action + ajaxsingle)"
       action="#{aliasHandler.onClickGoPage1}"
       reRender="result"
       immediate="true"
       ajaxSingle="true">
       </a4j:commandLink>
       <a4j:commandLink value="Page 2 (action + actionparam)"
       action="#{aliasHandler.onClickGoPage2}"
       reRender="result"
       immediate="true">
       <a4j:actionparam name="selectionOnglet"
       value="page2"
       assignTo="#{aliasHandler.value}"/>
       </a4j:commandLink>
       <a4j:commandLink value="Page 2 (action + actionparam + ajaxsingle)"
       action="#{aliasHandler.onClickGoPage2}"
       reRender="result"
       immediate="true"
       ajaxSingle="true">
       <a4j:actionparam name="selectionOnglet"
       value="page2"
       assignTo="#{aliasHandler.value}"/>
       </a4j:commandLink>
       <a4j:commandLink value="Page 3 (actionparam)"
       reRender="result"
       immediate="true">
       <a4j:actionparam name="selectionOnglet"
       value="page3"
       assignTo="#{aliasHandler.value}"/>
       </a4j:commandLink>
       <a4j:commandLink value="Page 3 (actionparam + ajaxsingle)"
       reRender="result"
       immediate="true"
       ajaxSingle="true">
       <a4j:actionparam name="selectionOnglet"
       value="page3"
       assignTo="#{aliasHandler.value}"/>
       </a4j:commandLink>
       </h:panelGrid>
      
       <h:panelGroup id="result"
       layout="block">
       <c:if test="${aliasHandler.value == 'page1'}">
       <h:outputText value="Page 1"/>
       </c:if>
       <c:if test="${aliasHandler.value == 'page2'}">
       <h:outputText value="Page 2"/>
       </c:if>
       <c:if test="${aliasHandler.value == 'page3'}">
       <h:outputText value="Page 3"/>
       </c:if>
       </h:panelGroup>
      
       </h:form>
       </t:aliasBean>
      
       <rich:messages layout="table" showDetail="true" showSummary="true" tooltip="true" />
       <a4j:log hotkey="m" level="#{contexte.ajaxLogLevel}" popup="true" style="width: 800px; height: 300px;"/>
       </body>
       </f:view>
      </HTML>

      I'll try to investigate more the bug, but perhaps will you have an idea just with the above code...

      h:form or a4j:form same issue :
      if i change the 'rendered' to use 'handler' instead of 'aliasHandler' then all works perfectly.



        • 1. Re: Regression 3.3.0 ? Bug after upgrade: action not execute
          ronanker

          testHandler :

          package com.vc.mm.handlers;
          
          import java.io.Serializable;
          
          public class TestHandler implements Serializable {
          
           private String value="page1";
          
           public String getValue() {
           return value;
           }
           public void setValue(String value) {
           this.value = value;
           }
          
           public boolean isRessourceSelectionnee() {
           return true;
           }
          
           public String onClickGoPage1() {
           value="page1";
           return null;
           }
           public String onClickGoPage2() {
           value="page2";
           return null;
           }
           public String onClickGoPage3() {
           value="page3";
           return null;
           }
          }


          • 2. Re: Regression 3.3.0 ? Bug after upgrade: action not execute
            ronanker

            here is a more complete testCase with also the suggestBox bug (even without ajaxSingle) :

            test.jsp

            <%@ page contentType="text/html;charset=UTF-8"%>
            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
            <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
            <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
            <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
            <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
            <%@ taglib uri="http://viragegroup.com/jsf/mm" prefix="vg" %>
            <HTML>
             <f:view>
             <head>
             <title>test</title>
             <meta http-equiv="pragma" content="no-cache" />
             <meta http-equiv="cache-control" content="no-cache" />
             <meta http-equiv="expires" content="0" />
             <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
             <vg:keepAlive beanName="testHandler"/>
             </head>
             <body>
             <a4j:status id="status" startText="ajax" stopText="iddle" />
            
             <t:aliasBean alias="#{aliasHandler}" value="#{testHandler}">
            
             <%--h:form id="formPage" rendered="#{testHandler.ressourceSelectionnee}"--%>
             <h:form id="formPage" rendered="#{testHandler.rendered}">
            
             <h:panelGrid columns="10">
             <a4j:commandLink value="Page 1 (action)"
             action="#{aliasHandler.onClickGoPage1}"
             reRender="result,formSuggest"
             immediate="true">
             </a4j:commandLink>
             <a4j:commandLink value="Page 1 (action + ajaxsingle)"
             action="#{aliasHandler.onClickGoPage1}"
             reRender="result,formSuggest"
             immediate="true"
             ajaxSingle="true">
             </a4j:commandLink>
             <a4j:commandLink value="Page 2 (action + actionparam)"
             action="#{aliasHandler.onClickGoPage2}"
             reRender="result,formSuggest"
             immediate="true">
             <a4j:actionparam name="selectionOnglet"
             value="page2"
             assignTo="#{aliasHandler.value}"/>
             </a4j:commandLink>
             <a4j:commandLink value="Page 2 (action + actionparam + ajaxsingle)"
             action="#{aliasHandler.onClickGoPage2}"
             reRender="result,formSuggest"
             immediate="true"
             ajaxSingle="true">
             <a4j:actionparam name="selectionOnglet"
             value="page2"
             assignTo="#{aliasHandler.value}"/>
             </a4j:commandLink>
             <a4j:commandLink value="Page 3 (actionparam)"
             reRender="result,formSuggest"
             immediate="true">
             <a4j:actionparam name="selectionOnglet"
             value="page3"
             assignTo="#{aliasHandler.value}"/>
             </a4j:commandLink>
             <a4j:commandLink value="Page 3 (actionparam + ajaxsingle)"
             reRender="result,formSuggest"
             immediate="true"
             ajaxSingle="true">
             <a4j:actionparam name="selectionOnglet"
             value="page3"
             assignTo="#{aliasHandler.value}"/>
             </a4j:commandLink>
             </h:panelGrid>
            
             <h:panelGroup id="result">
             <h:outputText value="Page 1" rendered="#{aliasHandler.value == 'page1'}"/>
             <h:outputText value="Page 2" rendered="#{aliasHandler.value == 'page2'}"/>
             <h:outputText value="Page 3" rendered="#{aliasHandler.value == 'page3'}"/>
             </h:panelGroup>
            
             </h:form>
            
             <h:form id="formSuggest">
             <h:panelGroup rendered="#{testHandler.value == 'page1'}">
             <h:inputText id="suggestInput1"
             value='#{aliasHandler.value2}'/>
             <rich:suggestionbox height="200" width="200"
             usingSuggestObjects="true"
             suggestionAction="#{aliasHandler.autoComplete}"
             var="result"
             for="suggestInput1">
             <h:column>
             <h:outputText value="#{result}"/>
             </h:column>
             </rich:suggestionbox>
             </h:panelGroup>
            
             <h:panelGroup rendered="#{aliasHandler.value == 'page2'}">
             <h:inputText id="suggestInput2"
             value='#{aliasHandler.value2}'/>
             <rich:suggestionbox height="200" width="200"
             usingSuggestObjects="true"
             suggestionAction="#{aliasHandler.autoComplete}"
             var="result"
             for="suggestInput2">
             <h:column>
             <h:outputText value="#{result}"/>
             </h:column>
             </rich:suggestionbox>
             </h:panelGroup>
             </h:form>
            
             </t:aliasBean>
             <rich:messages layout="table" showDetail="true" showSummary="true" tooltip="true" />
             <a4j:log hotkey="m" popup="true" style="width: 800px; height: 300px;"/>
             </body>
             </f:view>
            </HTML>


            TestHandler.java
            package com.vc.mm.handlers;
            
            import java.io.Serializable;
            import java.util.ArrayList;
            import java.util.List;
            
            public class TestHandler implements Serializable {
            
             /** <code>serialVersionUID</code> */
             private static final long serialVersionUID = 1L;
            
             private String value="page1";
             private String value2="";
             private List<String> listeComplete=null;
            
             public TestHandler() {
             super();
             listeComplete=new ArrayList<String>(2);
             listeComplete.add("choix1");
             listeComplete.add("choix2");
             }
            
             public String getValue() {
             return value;
             }
             public void setValue(String value) {
             this.value = value;
             }
            
             public boolean isRendered() {
             return true;
             }
            
             public String onClickGoPage1() {
             value="page1";
             return null;
             }
             public String onClickGoPage2() {
             value="page2";
             return null;
             }
             public String onClickGoPage3() {
             value="page3";
             return null;
             }
            
             public List<String> autoComplete(Object value) {
             return listeComplete;
             }
            
             public String getValue2() {
             return value2;
             }
             public void setValue2(String value2) {
             this.value2 = value2;
             }
            }
            


            the fist suggest (page 1) works but the second (page 2) doesn't...

            • 3. Re: Regression 3.3.0 ? Bug after upgrade: action not execute
              ronanker

              Hello,

              Can someone from richfaces team look what change in 3.3.0 can have cause this issue ?

              it's quite an important bug. and i can't finf any workaround.

              thanks.

              • 4. Re: Regression 3.3.0 ? Bug after upgrade: action not execute
                abelevich

                Could you provide myfaces, tomahawk versions?

                • 5. Re: Regression 3.3.0 ? Bug after upgrade: action not execute
                  adubovsky

                  Hi RonanKER,

                  Issue https://jira.jboss.org/jira/browse/RF-6231 was opened.

                  Thanks for your post.

                  • 6. Re: Regression 3.3.0 ? Bug after upgrade: action not execute
                    ronanker

                    i've tested with "tomahawk12-1.1.7" and "tomahawk12-1.1.8"
                    (i use only aliasBean from this package but in all the application about 280 times)

                    i've made evolution to my test case but no more workaround :

                    <%@ page contentType="text/html;charset=UTF-8"%>
                    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
                    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
                    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
                    <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
                    <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
                    <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
                    <%@ taglib uri="http://viragegroup.com/jsf/mm" prefix="vg" %>
                    <HTML>
                     <f:view>
                     <head>
                     <title>test</title>
                     <meta http-equiv="pragma" content="no-cache" />
                     <meta http-equiv="cache-control" content="no-cache" />
                     <meta http-equiv="expires" content="0" />
                     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
                     <vg:keepAlive beanName="testHandler"/><%-- keep request handler in session --%>
                     <style type="text/css">
                     .block{width:100%}
                     .ok{color:darkgreen}
                     .bug{color:darkred}
                     </style>
                     </head>
                     <body>
                     <a4j:region id="test_region">
                     <h:panelGroup id="test_panel" layout="block" styleClass="block">
                     <a4j:status id="status" startText="ajax" stopText="iddle" />
                     <t:aliasBean id="alias" alias="#{aliasHandler}" value="#{testHandler}">
                    
                     <%--h:form id="formPage" rendered="#{testHandler.ressourceSelectionnee}"--%>
                     <h:form id="formPage" rendered="#{aliasHandler.rendered}">
                    
                     <h:panelGrid columns="3">
                     <a4j:commandLink value="Page 1 (action)"
                     action="#{aliasHandler.onClickGoPage1}"
                     reRender="result,formSuggest"
                     styleClass="ok">
                     </a4j:commandLink>
                     <a4j:commandLink value="Page 2 (action + actionparam)"
                     action="#{aliasHandler.onClickGoPage2}"
                     reRender="result,formSuggest"
                     styleClass="ok">
                     <a4j:actionparam name="selectionOnglet"
                     value="page2"
                     assignTo="#{aliasHandler.value}"/>
                     </a4j:commandLink>
                     <a4j:commandLink value="Page 3 (actionparam)"
                     reRender="result,formSuggest"
                     styleClass="ok">
                     <a4j:actionparam name="selectionOnglet"
                     value="page3"
                     assignTo="#{aliasHandler.value}"/>
                     </a4j:commandLink>
                    
                     <a4j:commandLink value="Page 1 ( + ajaxsingle)"
                     action="#{aliasHandler.onClickGoPage1}"
                     reRender="result,formSuggest"
                     ajaxSingle="true"
                     styleClass="bug">
                     </a4j:commandLink>
                     <a4j:commandLink value="Page 2 ( + ajaxsingle)"
                     action="#{aliasHandler.onClickGoPage2}"
                     reRender="test_panel"
                     ajaxSingle="true"
                     styleClass="bug">
                     <a4j:actionparam name="selectionOnglet"
                     value="page2"
                     assignTo="#{aliasHandler.value}"/>
                     </a4j:commandLink>
                     <a4j:commandLink value="Page 3 ( + ajaxsingle)"
                     reRender="result,formSuggest"
                     ajaxSingle="true"
                     styleClass="bug">
                     <a4j:actionparam name="selectionOnglet"
                     value="page3"
                     assignTo="#{aliasHandler.value}"/>
                     </a4j:commandLink>
                    
                     <a4j:commandLink value="Page 1 ( + ajaxsingle + processAlias)"
                     action="#{aliasHandler.onClickGoPage1}"
                     reRender="result,formSuggest"
                     ajaxSingle="true"
                     process="alias"
                     styleClass="bug">
                     </a4j:commandLink>
                     <a4j:commandLink value="Page 2 ( + ajaxsingle + processAlias)"
                     action="#{aliasHandler.onClickGoPage2}"
                     reRender="test_panel"
                     ajaxSingle="true"
                     process="alias"
                     styleClass="bug">
                     <a4j:actionparam name="selectionOnglet"
                     value="page2"
                     assignTo="#{aliasHandler.value}"/>
                     </a4j:commandLink>
                     <a4j:commandLink value="Page 3 ( + ajaxsingle + processAlias)"
                     reRender="result,formSuggest"
                     ajaxSingle="true"
                     process="alias"
                     styleClass="bug">
                     <a4j:actionparam name="selectionOnglet"
                     value="page3"
                     assignTo="#{aliasHandler.value}"/>
                     </a4j:commandLink>
                     </h:panelGrid>
                     <br/>
                     <h:panelGroup id="result" style="padding:5px; margin:5px; border:solid black 2px">
                     <h:outputText value="Page 1" rendered="#{aliasHandler.value == 'page1'}"/>
                     <h:outputText value="Page 2" rendered="#{aliasHandler.value == 'page2'}"/>
                     <h:outputText value="Page 3" rendered="#{aliasHandler.value == 'page3'}"/>
                     </h:panelGroup>
                     </h:form>
                    
                     <h:form id="formSuggest">
                     <h:panelGroup rendered="#{testHandler.value == 'page1'}">
                     <h:outputText value="suggest1" title="testHandler + default ajaxSingle" styleClass="ok" />
                     <h:inputText id="suggestInput1" title="suggestInput1"
                     value='#{testHandler.value2}'/>
                     <rich:suggestionbox height="200" width="200"
                     usingSuggestObjects="true"
                     suggestionAction="#{testHandler.autoComplete}"
                     var="result"
                     for="suggestInput1">
                     <h:column>
                     <h:outputText value="#{result}"/>
                     </h:column>
                     </rich:suggestionbox>
                     </h:panelGroup>
                    
                     <h:panelGroup rendered="#{aliasHandler.value == 'page2'}">
                     <h:outputText value="suggest2" title="aliasHandler + default ajaxSingle" styleClass="bug" />
                     <h:inputText id="suggestInput2" title="suggestInput2"
                     value='#{testHandler.value2}'/>
                     <rich:suggestionbox height="200" width="200"
                     usingSuggestObjects="true"
                     suggestionAction="#{testHandler.autoComplete}"
                     var="result"
                     for="suggestInput2">
                     <h:column>
                     <h:outputText value="#{result}"/>
                     </h:column>
                     </rich:suggestionbox>
                     </h:panelGroup>
                    
                     <h:panelGroup rendered="#{aliasHandler.value == 'page3'}">
                     <h:outputText value="suggest3" title="aliasHandler + ajaxSingle='false' so it submits the input value" />
                     <h:inputText id="suggestInput3" title="suggestInput3"
                     value='#{testHandler.value2}'/>
                     <rich:suggestionbox height="200" width="200"
                     usingSuggestObjects="true"
                     suggestionAction="#{testHandler.autoComplete}"
                     ajaxSingle="false"
                     var="result"
                     for="suggestInput3">
                     <h:column>
                     <h:outputText value="#{result}"/>
                     </h:column>
                     </rich:suggestionbox>
                     </h:panelGroup>
                    
                     <h:panelGrid columns="1">
                     <a4j:commandLink value="test (nothing)"
                     reRender="test_panel"
                     title="save form"/>
                     <a4j:commandLink value="test (ajaxsingle)"
                     reRender="test_panel"
                     ajaxSingle="true"
                     title="undo form"/>
                     <a4j:commandLink value="test (ajaxsingle + process1)"
                     reRender="test_panel"
                     ajaxSingle="true"
                     process="suggestInput1"
                     title="save only input1"
                     styleClass="ok"/>
                     <a4j:commandLink value="test (ajaxsingle + process2)"
                     reRender="test_panel"
                     ajaxSingle="true"
                     process="suggestInput2"
                     title="save only input2"
                     styleClass="bug"/>
                     <a4j:commandLink value="test (ajaxsingle + process3)"
                     reRender="test_panel"
                     ajaxSingle="true"
                     process="suggestInput3"
                     title="save only input3"
                     styleClass="bug"/>
                     <a4j:commandLink value="test (ajaxsingle + processAlias)"
                     reRender="test_panel"
                     ajaxSingle="true"
                     title="save all childs of 'alias'"
                     process="alias"/>
                     </h:panelGrid>
                     </h:form>
                    
                     </t:aliasBean>
                     </h:panelGroup>
                     </a4j:region>
                     <rich:messages id="messages" layout="table" showDetail="true" showSummary="true" tooltip="true" ajaxRendered="true" />
                     <a4j:log popup="false" style="position: absolute; width: 60%; height: 60%; bottom:0px; right:0px; z-index:1000" />
                     </body>
                     </f:view>
                    </HTML>


                    package com.vc.mm.handlers;
                    
                    import java.io.Serializable;
                    import java.util.ArrayList;
                    import java.util.List;
                    
                    public class TestHandler implements Serializable {
                    
                     /**Declaration de <code>serialVersionUID</code>*/
                     private static final long serialVersionUID = 1L;
                    
                     private String value="page1";
                     private String value2="";
                     private List<String> listeComplete=null;
                    
                     public TestHandler() {
                     super();
                     listeComplete=new ArrayList<String>(2);
                     listeComplete.add("choix1");
                     listeComplete.add("choix2");
                     }
                    
                     public String getValue() {
                     return value;
                     }
                     public void setValue(String value) {
                     this.value = value;
                     }
                    
                     public boolean isRendered() {
                     return true;
                     }
                    
                     public String onClickGoPage1() {
                     value="page1";
                     return null;
                     }
                     public String onClickGoPage2() {
                     value="page2";
                     return null;
                     }
                     public String onClickGoPage3() {
                     value="page3";
                     return null;
                     }
                    
                     public List<String> autoComplete(Object value) {
                     return listeComplete;
                     }
                    
                     public String getValue2() {
                     return value2;
                     }
                     public void setValue2(String value2) {
                     this.value2 = value2;
                     }
                    }
                    


                    the issue seems to be a too early check of the 'rendered' value of a container that stops serching component when using a ajaxSingled command.
                    we should either continue seraching children even if 'rendered' value is false or to make this search later when the aliasBean will have been set.

                    thank you for the time you spend solving this bug.

                    • 7. Re: Regression 3.3.0 ? Bug after upgrade: action not execute
                      alex.kolonitsky

                      I checked it on 3.2.2 and 3.2.1 and I have same behaviour as on 3.3.1. If you set ajaxSingle="true" then on a ajax request the t:aliasBean is not processed and doesn't apply aliasing, in this case rendered attribute for commandLink calculate as false and it doesn't fire listeners for them.

                      If you want know why you have problem on migration please send more info.

                      • 8. Re: Regression 3.3.0 ? Bug after upgrade: action not execute
                        ronanker

                        Hello, thanks for your investigations.

                        I agree that in 3.2.2-SR1 it fail like un 3.3.0.GA and probably 3.3.1.nightly
                        But with 3.2.1.GA all the links in my test are working well... and it seems to me that it's like it should work.

                        if the issue for you comes from t:aliasBean, will you code a rich:aliasBean that will work correctly ?
                        What can i do to have a correct page without migrating to facelets ?

                        • 9. Re: Regression 3.3.0 ? Bug after upgrade: action not execute
                          ronanker

                          you can download here : http://pmint.p-monitor.com/RF-6231.zip
                          a zip with 3 ear, test for 3.2.1, 3.2.2, 3.3.0