2 Replies Latest reply on Mar 30, 2011 4:54 AM by ilya_shaikovsky

    ValueChangeListener question( Happen Before setXXX) ?

    sohochaser

      Dear Experts,

       

      I am using jsf2 + richfaces 4.0.0.20110227-CR1. I Have q eustion about the phase of the life cycle.

       

      I am trying to draw image based user's choice. There eixst a checkbox, when use select or deselect the checkbox, the image will be refreshed.

       

      THe problem is the maxSelected() will be called before the setShowMax. So in the redraw(), showMax is still old value?

       

      Do any one has good solution for it? Can i call setShowMax before the valueChangeListener called?

       

      Thanks in advance.

       

      <h:selectBooleanCheckbox value="#{reportBean.showMax}" id="max"

                                  valueChangeListener="#{reportBean.maxSelected}">

                                  <a4j:ajax event="change" render="imageTable, rep" />

                              </h:selectBooleanCheckbox>

       

      Here is my bean

      {

          ...

             private boolean showMax;

       

          public boolean isShowMax() {

              return showMax;

          }

       

       

          public void setShowMax(boolean showMax) {

              this.showMax = showMax;

          }

       

       

       

           public void maxSelected(ValueChangeEvent event) {

                        redraw();

          }

       

           public void redraw(boolean drawMax)

          {

                  if(showMax)

                  {

                   ....

                  }

                  else

                  {

                   ....

                  }

          }

          ...

      }