You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Joachim Schmid <pa...@gmx.net> on 2006/05/17 10:31:50 UTC

Problem with SelectOneMenu and Converter

Hi,
I'm using SelectOneMenu with a converter. Now I tried the new version of
myfaces and I've a Problem:
on submit the converter will be invoked and returns the correct object. But
the setter of my bean is never called, to the value stored in the bean is
always the old one.

I tried with 1.1.1 and 1.1.3. No difference.
Has anyone an Idea?
Thanks,
Joe

Re: Re: Problem with SelectOneMenu and Converter

Posted by Joachim Schmid <pa...@gmx.net>.
OK, I've found the problem.
The SelectOneMenu checks after conversion, if the converted object is in the list of available objects. For that reason, it calls the converter of every single entry and makes a check with the equals function of the Object class. My Converter reads the values out of a database and for that reason, I will get objects with new java object ids. Then the check fails, because the objects have the right content but not the same java id.
I solved the Problem by overriding the equals function of my data objects.

Thanks for help.
Joe
-------- Original-Nachricht --------
Betreff: Re: Problem with SelectOneMenu and Converter
Datum: Wed, 17 May 2006 14:31:36 -0400
Von: "Mike Kienenberger" <mk...@gmail.com>
An: "MyFaces Development" <de...@myfaces.apache.org>

> On 5/17/06, Joachim Schmid <pa...@gmx.net> wrote:
> > I'm using SelectOneMenu with a converter. Now I tried the new version of
> > myfaces and I've a Problem:
> > on submit the converter will be invoked and returns the correct object.
> But
> > the setter of my bean is never called, to the value stored in the bean
> is
> > always the old one.
> 
> Probably something on the page is failing validation or conversion and
> the update model phase is never being invoked.  Try sticking a
> t:messages object on the page (both with and without global messages).

Re: Problem with SelectOneMenu and Converter

Posted by Mike Kienenberger <mk...@gmail.com>.
On 5/17/06, Joachim Schmid <pa...@gmx.net> wrote:
> I'm using SelectOneMenu with a converter. Now I tried the new version of
> myfaces and I've a Problem:
> on submit the converter will be invoked and returns the correct object. But
> the setter of my bean is never called, to the value stored in the bean is
> always the old one.

Probably something on the page is failing validation or conversion and
the update model phase is never being invoked.  Try sticking a
t:messages object on the page (both with and without global messages).

Problem with SelectOneMenu and Converter

Posted by Joachim Schmid <pa...@gmx.net>.
Hi,
I'm using SelectOneMenu with a converter. Now I tried the new version of
myfaces and I've a Problem:
on submit the converter will be invoked and returns the correct object. But
the setter of my bean is never called, to the value stored in the bean is
always the old one.

I tried with 1.1.1 and 1.1.3. No difference.
Has anyone an Idea?
Thanks,
Joe