Dropdown - change the option list

Hello all,

I have a question concerning the dropdown control.

  • I can retrieve the UIComponent and then change the current selected value.
  • I can modify the values listed by the dropdown by calling a service which is binded to the option group.

But I can’t manage to change the values listed without calling a service binded to the option group.
Does anyone know how can I manage to change the values listed in the dropdown directly in java by setting the value I already know ?

I’m currently searching in the “UISelectItems” direction (which seems to be the UIComponent of the option group attached to the dropdown).


Hi Mathieu,
I suppose you have a dropdown with an OptionsGroup as children.
In Java you can get access to that OptionsGroup (it will be a javax.faces.component.UISelectItems).Then you get its value as an array, list or as a BoundPropertiesSelectItemGroupProvider (which in turn has an array/list that you can set) and set its contents with what you wish.

hope this helps,

p.s.: I don’t go into java details about how this is done cause I suppose you know it already, but let me know if you need an snippet as well.

Thx Javier,

You helped me a lot, It works fine.

I was missing the logic of setting an arrayList with the setValue method of the UISelectItems component. I was looking for an addItem method which was wrong.