Hi,
I am using netbeans 6.1 to develop a JSF web application where i need to populate a listbox with dynamic values from a DB. (Mysql)...
am trying to use selectOneListbox ui and feed it dynamic values.
<h:selectOneListbox binding="#{Testing_page.chpt_detail_lst}" id="chpt_detail_lst"
onchange="common_timeoutSubmitForm(this.form, 'chpt_detail_lst');" size="5"
style="height: 192px; left: 408px; top: 144px; position: absolute; width: 168px" valueChangeListener="#{Testing_page.chpt_detail_lst_processValueChange}">
<f:selectItems id="chpt_list" value="#{Testing_page.chpt_detail_lstDefaultItems}"/>
</h:selectOneListbox
I am able to set static values to the listbox using 'SelectItem[]" but when i try to feed the listbox dynamic values using selectitem in the getter function it doesn't work.
{code}private List chpt_detail_lstDefaultItems = { new SelectItem(new Integer(1), "Atkljkkjkjklom"),
new SelectItem(new Integer(2), "Cathod Ray"),
new SelectItem(new Integer(3), "English"),
new SelectItem(new Integer(4), "Ripple tank")
};{code}
I tried to replace SelectItem with List but that gave me a whole bunch of other errors.
basically please guide me how to simply change/edit/delete items from a listbox on runtime.