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: [Trinidad] tr:selectOneChoice and Objects that cannot override equals
Date Wed, 26 Mar 2008 21:02:39 GMT
Use a custom converter on the choice that converts your object, or
register a class-converter for all the different classes in your app
that need to be converted.

On Tue, Mar 25, 2008 at 4:50 PM, Justin Mckay <justin.mckay@famis.com> wrote:
>
>
>
>
> I have a situation where I have some generated objects that do not override
> equals that I would like to use in a selectOneChoice field.  The  issue is
> the selected object may not be the same object from the list of objects in
> the selectItems.  For instance:
>
>
>
> <tr:selectOneChoice value="#{bean.person}">
>
>      <f:selectItems value="#{peopleFinder.people}"/>
>
> </tr:selectOneChoice>
>
>
>
> So here bean.Person is a generated type Person and peopleFinder.people will
> be a Map<String,Person> of the same generated type.
>
>
>
> The way we have been handeling this is we have been wrapping the objects
> with another object that has a properly implemented equals method.  This
> works but requires us to write more code, I was thinking there would be an
> easier way to do this, any ideas?
>
>
>
> Thanks,
>
>
>
> Justin

Mime
View raw message