myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elenh Tsigka ...@eworx.gr>
Subject SelectOneMenu - selectItems: list population problem
Date Tue, 11 Jul 2006 13:09:39 GMT
Hi,

In my jsf page, I use a h:selectOneMenu which contains a f:selectItems. 
The attribute value of the selectItems element is a list which is 
populated from a backing bean. The jsf snippet is like this:

<h:selectOneMenu id="selectList" value="#{backingBean.selectedHotel}">
    <f:selectItems value="#{backingBean.selectionList}" 
rendered="#{backingBean.selectionList != null}"/>
</h:selectOneMenu>

My problem is that I want to associate an object (Hotel, which has many 
metadata) with this selectionList. The drop down list will show the name 
(String) of the Hotel, but when selecting an item from the list I want 
to get a reference to the appropriate object (Hotel).

In my backingBean I have
    selectionList = new ArrayList();   
Which is populated through a for loop like this:
    selectionList.add(new SelectItem(Hotel));
 
I get an error indicating that I have to use a converter, as the 
SelectItem isn't a String.
Is there an alternative to using a converter?
Isn't there a similar mechanism to this used by the datatable, which is 
bind to a set of objects?



Mime
View raw message