Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

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!

JSF SelectOneMenu & ValueChangeListeners

843842Apr 3 2006 — edited Apr 4 2006
Hello all,

I have two SelectOneMenus:

1) menu1 with value="#{bean.item1}"
2) menu2 with value="#{bean.item2}"

I also have a ValueChangeListener attached to menu1.

I would like when the selection in menu1 is changed, the selection in menu2 to be changed as well. I tried changing the value of bean.item2 in the valuechangelistener of menu1, but this does not help - the JSF framework in the "update model values" phase calls the setter again and overwrites the value I set. I also tried calling the .RenderResponse() method of the faces context (in order to skip this phase), but then the framework does not even call the getter of item2, so the old value remains unmodified. So I tried different ways, but I made no progress in changing the selection in the second list box.

On the other hand, I noticed that when I change the value that the f:selectItems is bound to, then everything is OK and this value is updated after the valuechangelistener. So, the value of selectOneMenu cannot be updated, while the value of the selectItems is.

Do you have any ideas why this happens and how I can update the value of the second SelectOneMenu in the valuechangelistener of the first selectOneMenu?

Best Regards,
Slavi
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 2 2006
Added on Apr 3 2006
6 comments
242 views