Does anyone have a working snippet they can share on this? I've been hacking on this for some time, but no luck. Here's what I want to do.
I have a selectOneMenu that I wish to populate from a database. I get the values fine. However, I can't seem to set the selected item in that dropdown. It always defaults to the top one in the list. I have tried method binding, value binding and the whole 9 yards, but I can't seem to set this thing before it renders.
A related problem - when I select a value in this combo box, it changes to display the correct one. I submit the form and it goes away. It seems like something is saving the prior state and resetting it. I am not doing a save state myself.
Here's the hitch. I'm not using a simple select item - I have to carry a DB id with each select item, so I had to make a IdSelectItem subclass of SelectItem. Then I had to write a converter to display it (why it couldn't just recognize this was a subclass of SelectItem and render as such I'll never know).
If anyone has a clue on where I should go from here, I'd be grateful!
Joined: Jul 15, 2005
Could you please post your current code?
Joined: Jun 02, 2000
Can't post the code - I work for BTSO (OK, those of you with kids - ever watch Jimmy Neutron with your kids? You'll know what I mean.)
My problem wasn't with the JSF code at all, it was a Hibernate mapping issue on the back end - submittedValues didn't match what was in the dropdown list.