Hi all, I have a Simple question of SelectOneMenu
In my bean I have an ArrayList with Patients, that is fill with an EJB
method. Patient object have the patientId and the patientName
Now how I can display it on a SelectOneMenu??
I searched and saw something like the following code, what I didn“t
understand was: what myBean.selectedItem is, I know that
myBean.selectedItems is the ArrayList, but what is selectedItem? Can
someone give a simple example for this simple question, thanks
JSF
<h:selectOneMenu value="#{myBean.selectedItem}">
<f:selectItems value="#{myBean.selectItems}" />
</h:selectOneMenu>
MyBean
*private* Integer selectedItem; // + getter + setter
*public* List getSelectItems() {
List selectItems = *new* ArrayList();
selectItems.add(*new* SelectItem(integer1, string1);
selectItems.add(*new* SelectItem(integer1, string2);
...
*return* selectItems;
}