File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes ValuechangeListener does not change the value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "ValuechangeListener does not change the value" Watch "ValuechangeListener does not change the value" New topic

ValuechangeListener does not change the value

Priti Shah
Ranch Hand

Joined: May 10, 2005
Posts: 43

I have two drop down menus, each bounded to a property in bean (integer)

Now I have a valueChangeListener on menu1 which changes the value of menu2 and disables it.

Everything works fine onchange of menu1 it changes the integer value of
menu2 and disables it but it does not change the selected value in
menu2 according to newly set integer value.

This my jsf code

And here is my valueChangeListener code

I also have set and get method for both the fields.

Am I still missing any thing?

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Did you ever find the solution to your problem??
Any clue appreciated.
Tom Fulton
Ranch Hand

Joined: Mar 30, 2006
Posts: 96
I had a number of problems with ValueChangeListeners in JSF until I spend several days figuring out what's happening "under the hood". The documentation is inadequate, and some of the better books are just plain wrong. I wrote up some information about this here. The part that might be affecting your application is this:
If you want a component to directly update the appearance of another component, both must have their immediate attribute set to �true� or the behavior is �unspecified��which means it doesn�t work, at least in the RI. And again, the form must be submitted (absent any Ajax processing to do so)
. Based on what I was seeing in your code, I don't think both components are set to "immdiate='true'"
I agree. Here's the link:
subject: ValuechangeListener does not change the value
It's not a secret anymore!