Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ValueChangeListener called before update model values?

robinvanAug 25 2013 — edited Aug 26 2013

I have a snippnet code jspx

<af:selectBooleanCheckbox text="selectBooleanCheckbox 1" label="Label 1" id="sbc1"

                                              binding="#{bean3.checkbox}" autoSubmit="true"

                                              valueChangeListener="#{bean3.changeValue}"/>

<f:facet name="footer"/>

And code in bean view Scope.

        public void changeValue(ValueChangeEvent valueChangeEvent) {

            // Add event code here...

            System.out.println(checkbox.getValue());

            System.out.println(valueChangeEvent.getOldValue());

            System.out.println(valueChangeEvent.getNewValue());

        }

Result is  false  true false or  true false true.

But I thought that checkbox.getValue() is same value with valueChangeEvent.getOldValue() because ValueChangeListener was called before value of checkbox was updated. Why is that?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 23 2013
Added on Aug 25 2013
5 comments
437 views