9 Replies Latest reply on Dec 2, 2012 11:26 PM by Luis Eduardo Agudelo González

    Problem with updating values, a4j:commandButton

    Andrey Iskrich Newbie

      Greetings!

       

      I have a problem with receiving updated value from a backing bean using actionListener or action attribute in a4j:commandButton.

       

      That's the point:

      part of my xhtml page:

       

      <h:form prependId="false" styleClass="style1">            
          <table cellpadding="0" cellspacing="2" border="2" bgcolor="#adff2f" align="center">
              <tr align="justify" valign="baseline">
                  <td colspan="5">
                      <h:inputText id="txtExpression" value="#{calcBean.expression}" ajaxRendered="true"/>
                  </td>
              </tr>
              <tr align="center" valign="middle">
                  <td>
                      <a4j:commandButton value="1" action="#{calcBean.add1}" reRender="txtExpression"/>
                  </td>
      ...
      </h:form>
      

       

      the code of the event processor is:

       

       

      @ManagedBean(name = "calcBean")
      @SessionScoped
      public class CalcBean {
      
           protected String expression = "2 + 3";
      
           /* Getters and setters */
           ...
      
           /* Action processors */
           public Object add1(){
              this.setExpression(expression.concat("1"));
              return null;
           }
      }
      

       

      So. After pushing button '1', i'm expecting to see "2+31" in my textArea, but it still showing 2+3.

      How can i fix it?