You must supply faces with a list of SelectItem's so that:
public List getCountryList(){
return countryManager.getCountries() ;
}
becomes:
psudo Code:
public List getCountryList(){
List selectItems=new ArrayList();
for (Iterator iterator = countryManager.getCountries().iterator();
iterator.hasNext();)
{
Country value = (Country)iterator.next();
SelectItem item = new SelectItem(value.getId(),
value.getLabelText());
selectItems.add(item);
}
return selectItems;
}
Hope this helps
Rhys
-----Original Message-----
From: John Ruffin [mailto:[EMAIL PROTECTED]
Sent: April 21, 2006 1:03 PM
To: [email protected]
Subject: <newbie?> selectOneMenu
I pull a List of countries from db2 using hibernate like this:
public List getCountries() {
return getHibernateTemplate().find("from Country"); }
In my managed bean I inject a manager and use it to call the above:
public List getCountryList(){
return countryManager.getCountries() ;
}
You proabably already see my problem... In my jsp, this doesn't work:
<h:selectOneMenu id="parentCountryList" value="#{parentForm.selectedCountry
}" >
<f:selectItems value="#{parentForm.countryList}"/>
</h:selectOneMenu>
Error message: java.lang.IllegalArgumentException: Collection referenced by
UISelectItems with id parentForm:_id3 does not contain Objects of type
SelectItem
When/how do I make the country objects SelectItem(s)???
--
View this message in context:
http://www.nabble.com/%3Cnewbie-%3E-selectOneMenu-t1487788.html#a4030320
Sent from the MyFaces - Users forum at Nabble.com.