Your object must converted into a representation which is a legal
value for a html option tag. e.g.:

<option value="convertedValue">label</option>

and convertedValue must convertable back to your Object if selected
and send back to the server.


Regards,
    Volker

2007/9/17, Evgeniy Karimov <[EMAIL PROTECTED]>:
> Thank you, but I don't really understand why I should use any converter at 
> all? Why I must convert my object to anything?
>
> -----Original Message-----
> From: David Delbecq <[EMAIL PROTECTED]>
> To: MyFaces Discussion <users@myfaces.apache.org>
> Date: Mon, 17 Sep 2007 18:27:04 +0200
> Subject: Re: SelectItem's constructor's "value" parameter and selectOneListBox
>
> >
> > You must either define an implicit converter "for-class" MyObject in
> > your jsf-config.xml, or use and explicit converter in your
> > h:selectOneListBox.
> >
> > In case of implicit convertion, type of #{myBackingBean.listBoxValue}
> > will be used to decide what converter to use.
> >
> > Regards,
> > David Delbecq
> >
> > Evgeniy Karimov a &#233;crit :
> > > Hi, I have some problem:
> > > Say I have
> > >  <h:selectOneListBox value="#{myBackingBean.listBoxValue}" ... >
> > >   <f:selectItems value="#{myBackingBean.listBoxValuesList}">
> > >  </h:selectOneListBox>
> > >
> > > Where myBackingBean.listBoxValue is of type MyObject.
> > >
> > > And myBackingBean.listBoxValuesList is ArrayList<SelectItem>, which items 
> > > are constructed as:
> > >  new SelectItem(myObj, myObj.getDescription(), myObj.getDescription()), 
> > > where myObj is type of MyObject.
> > >
> > > Everything looks fine, but I get an exception with some message like: 
> > > "Value is no String ... does not have a Converter". Seems like 
> > > myBackingBean.listBoxValue must be of String type, but this isn't logical 
> > > because first argument of SelectItem constructor is of Object type, so it 
> > > _should_ be possible to use MyObject as a value of ListBox, isn't it?
> > >
> > >      Thanks in advance.
> > >
> >
>

Reply via email to