4 Replies Latest reply on Feb 19, 2013 8:16 AM by Gábor Péntek

    a4j:commandButton action isn't invoked after rerender

    jackjackrus Newbie

      Hi, I'm in trouble.

       

      After a4j:commandButton has been rerendered the first time it is clicked no action method is invoked. Example below. Click on "break all"  button and then on "click" button and you will see that click counter is not incremented.

       

      xhtml:

      <html
          xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:rich="http://richfaces.org/rich"
          xmlns:a4j="http://richfaces.org/a4j"
          xmlns:f="http://java.sun.com/jsf/core">
          <h:head/>
          <h:body>
                <a4j:log />
                <h:panelGrid id="counters">
                    <h:outputText value="Click count: #{testBean.clickCount}"/>
                    <h:outputText value="Render count: #{testBean.renderCount}"/>
                </h:panelGrid>
                <h:panelGroup id="controls">
                    <h:form >
                          <a4j:commandButton value="Click"
                                                 action="#{testBean.clickButtonAction}"
                                                 render="counters"
                                                 execute="@this"/>
                    </h:form>
                </h:panelGroup>
                <h:form>
                    <a4j:commandButton value="break all" render="controls" />
                </h:form>
          </h:body>
      </html>
      
      

       

      bean:

      @ManagedBean
      @SessionScoped
      public class TestBean {
      
      
          public TestBean() {
          }
      
      
          int clickCount=0;
          public int getClickCount() {
                return clickCount;
          }
      
      
          int renderCount=0;
          public int getRenderCount() {
                return renderCount++;
          }
      
      
          public void clickButtonAction(){
                clickCount++;
                Logger.getLogger(this.getClass()).debug("Clicked!");
          }
      }
      

       

      Did I miss something?

       

      Using RF 4.0.0.Final and Mojarra 2.1.1.