changing the selection of a drop down list manually
I want to change the selected item of a drop down list based on the selection in a check box. I tried using the setSelected() method but it didn't work.Can anyone help me with this plz?
[200 byte] By [
karim86] at [2007-11-26 9:17:25]

# 1
I think you have to store the value, setted in the checkbox ,in a session bean.Then set the selected item of the dropdown ,in the init() method using the value in the sessionbean.Unless you do this,your item that you set in dropdown will be lost after the "post" operation.
gkhn at 2007-7-6 23:45:10 >

# 4
Hi,
A drop down component uses two values:
1. The real options value. This can be an object of any kind (String, Integer, etc)
2. The displayed value.
When you use the setSelected(Object), the "Object" must be the same class as the real options value (the one you used when you populated the list). It succeeds is there is a matching real options value in the list.
The Drop Down List component does not work with indexes (as Swing component does).
AG