yes, but you must provide a way to convert those items in strings and
vice-versa... a class implementing the Converter interface.
here an example:
public class ShipperConverter implements Converter{
public Object getAsObject(FacesContext facesContext, UIComponent
uiComponent, String s) throws ConverterException {
Dao dao = new Dao();
return dao.loadObjectShipperById.(Long.decode(s));
}
public String getAsString(FacesContext facesContext, UIComponent
uiComponent, Object o) throws ConverterException {
if(o!= null)
Log.log.debug(o.toString());
try {
if((o!= null) && (o instanceof Shipper)){
Shipper shipper = (Shipper) o;
return ""+shipper.getIdShipper();
}
else
return "0";
} catch (Exception e) {
Log.log.error(e);
throw new ConverterException();
}
}
}
It is a very simplified version of the roiginal class but I think it
get the point..
hope it helps
2005/9/12, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> Hi,
>
> I want to put Objects (DTOs) in my SelectItems, to be able to
> submit it in the Save, but i always get the Error Value is no String
> error from the renderer.
>
> java.lang.IllegalArgumentException: Value is no String and component
> userForm:groupListBox does not have a Converter
> at
> org.apache.myfaces.renderkit.RendererUtils.getConvertedStringValue(Rende
> rerUtils.java:670)
> at
> org.apache.myfaces.renderkit.RendererUtils.getConvertedStringValue(Rende
> rerUtils.java:688)
> at
> org.apache.myfaces.renderkit.html.HtmlRendererUtils.renderSelectOptions(
> HtmlRendererUtils.java:459)
> <SNIP LONG TRACE>
>
> javax.faces.FacesException: Value is no String and component
> userForm:groupListBox does not have a Converter
>
>
> Does anybody have any idea what could be wrong here? I thought I could
> put any type of object in my SelectItem...
>
> Thanks,
>
> Greg
>
--
::SammyRulez::
http://sammyprojectz.blogspot.com