You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "H. Swaczinna" <sw...@wlp-systems.de> on 2007/02/01 18:52:36 UTC

[Tobago] Lifecylce problem with renderedPartially and selectBooleanCheckbox

Hello,

I've a selectBooleanCheckbox with a nested command tag with a
renderedPartially attribute. The selectBooleanCheckbox has a 
valueChangeListener. The valueChangeListener should be called and
then some part of the page reloaded when the checkbox is clicked. This 
works in general but the lifecycle sequence is not correct. The 
valueChangeListener is called first and then the value is written back 
to the model. It should be vice versa.

JSP:

<tc:panel id='panel'>
...
    <tc:selectBooleanCheckbox id="checkbox"
      valueChangeListener="#{controller.valueChangeListener}"
      value="#{controller.checkbox}">
    <f:facet name="change">
      <tc:command>
        <tc:attribute name="renderedPartially"
          value="panel"/>
      </tc:command>
    </f:facet>
    </tc:selectBooleanCheckbox>
...

Java:

  public void valueChangeListener(ValueChangeEvent e) {
    LOG.debug("valueChangeListener: " + e.getNewValue());
  }

  public void setCheckbox(Boolean checkbox) {
    LOG.debug("setCheckbox: " + checkbox);
  }

LOG:

...
controller - valueChangeListener: true
controller - setCheckbox: true
...


Regards
Helmut

Re: [Tobago] Lifecylce problem with renderedPartially and selectBooleanCheckbox

Posted by Volker Weber <v....@inexso.de>.
Hi Helmut,

this is the correct behavior.

ValueChangeListeners are fired in validationPhase (see jsf1.1 spec 3.2.5.3),
setters are executed in updateModelPhase.

Should be the same as without ajax.

Regards,
  Volker

2007/2/1, H. Swaczinna <sw...@wlp-systems.de>:
> Hello,
>
> I've a selectBooleanCheckbox with a nested command tag with a
> renderedPartially attribute. The selectBooleanCheckbox has a
> valueChangeListener. The valueChangeListener should be called and
> then some part of the page reloaded when the checkbox is clicked. This
> works in general but the lifecycle sequence is not correct. The
> valueChangeListener is called first and then the value is written back
> to the model. It should be vice versa.
>
> JSP:
>
> <tc:panel id='panel'>
> ...
>     <tc:selectBooleanCheckbox id="checkbox"
>       valueChangeListener="#{controller.valueChangeListener}"
>       value="#{controller.checkbox}">
>     <f:facet name="change">
>       <tc:command>
>         <tc:attribute name="renderedPartially"
>           value="panel"/>
>       </tc:command>
>     </f:facet>
>     </tc:selectBooleanCheckbox>
> ...
>
> Java:
>
>   public void valueChangeListener(ValueChangeEvent e) {
>     LOG.debug("valueChangeListener: " + e.getNewValue());
>   }
>
>   public void setCheckbox(Boolean checkbox) {
>     LOG.debug("setCheckbox: " + checkbox);
>   }
>
> LOG:
>
> ...
> controller - valueChangeListener: true
> controller - setCheckbox: true
> ...
>
>
> Regards
> Helmut
>