myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Robinson" <andrew.rw.robin...@gmail.com>
Subject Re: Simple Question SelectOneMenu
Date Wed, 25 Jul 2007 14:59:01 GMT
It would be the same type as what the converter returns from the
selectOneMenu control. In your case, you will need to convert Strings
to Integer so that the submitted value can be converted into the same
type as your bean field.

On 7/25/07, daniel ccss <danielccss2@gmail.com> wrote:
> 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>
>
>
> MyBeanprivate 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;
>
> }
>
>
>
>
>
>

Mime
View raw message