I tried a quick test with a selectManyListbox and get the same error.
Regarding setting a breakpoint, I'm having trouble getting my debugger (I'm
using NetBeans 5.5.1) to attach, so I that may be yet another problem to
resolve.  Thanks for your help...I'll post back if I come up with something
useful.

-----Original Message-----
From: Mike Kienenberger [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 29, 2007 2:26 PM
To: MyFaces Discussion
Subject: Re: SelectManyPickList: "Value Is Not Valid"

Tim,

Your equals method looks fine to.   I don't think your situation is
related to Users.equals() in this case, but maybe I missed something.
 I hadn't read the article until now, but it's just saying (like I
did) that having an equals() method using == is the general reason for
this error [Object's equals() doesn't account for the fact that the
original object and the restored serialized object are not the same
object].

At this point, I guess you need to set a breakpoint at the code
generating the error, and examine the state of your variables to see
why you got there.   Maybe there's a bug in SelectManyPickList.   Can
you try testing it with a SelectManyMenu/SelectManyListBox (or
whatever else is there by default) and see if it generates errors?

I tried using SelectManyPickList a couple weeks ago, but it was too
primitive to do what I wanted -- I ended up using two t:dataTables
with server-side-processing buttons to move selected items between the
lists.


On 3/29/07, Romanowski, Tim <[EMAIL PROTECTED]> wrote:
> Thanks for the response Mike.  My user objects have a working equals
method,
> but that seems to be the problem.  From the link I enclosed, the problem
is
> that on submission of any SelectMany component, each value of the
collection
> is compared with the rest of the collection...since all but one will
return
> false, a validation error occurs.  What I don't understand, is what the
fix
> for the equals method should be.  I don't want to blindly return true on
the
> User class' equals method.  I don't think this is what you are suggesting,
> but I could be mistaken.
>
> Regarding your suggestions to make sure that the objects in
> team.userCollection fulfill
> team.getUserSelectItems().contains(userCollection<item, do you mean
> something other than just make sure that the submitted form is in fact
> submitting the correct userCollection?  It is--I've added some logging in
my
> Users.equals() method to verify that the right values are being submitted,
> and the team.getUserCollection() method does indeed return the correct
user
> objects.  However, the problem is exactly as described in that link
> below...except I don't understand how one fixes the overridden equals
method
> to solve this problem.
>
> What is the general method for handling the submission of a collection to
> UISelectMany, when the collection contains non-String objects (i.e., User
> objects in my case)?
>
>
> Here is my Users.equals():
>
>     public boolean equals(Object object) {
>         if (!(object instanceof Users)) {
>             return false;
>         }
>         Users other = (Users)object;
>         if (this.username != other.username && (this.username == null ||
> !this.username.equals(other.username))) return false;
>         return true;
>     }
>
> Tim
>
>
> -----Original Message-----
> From: Mike Kienenberger [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 29, 2007 1:43 PM
> To: MyFaces Discussion
> Subject: Re: SelectManyPickList: "Value Is Not Valid"
>
> I'd say that the first thing to check is that your user objects have a
> working equals() method.
>
> Ie, make sure that the objects in team.userCollection fulfill
> team.getUserSelectItems().contains(userCollection<item>).
>
> Failing that, step through the debugger and see what's going on.
>
> On 3/29/07, Romanowski, Tim <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> > Hi everyone,
> >
> > I'm trying to use the SelectManyPicklist component from the sandbox, and
> I'm
> > running into exactly the issue that is described at [1].  Basically, I
> > create an ArrayList of my own User objects, and pass that as the value
for
> > my component as such:
> >
> >
> >
> > <s:selectManyPickList id="teamMembers" value="#{team.userCollection}">
> >
> >                        <f:selectItems value="#{team.userSelectItems}"/>
> >
> >                    </s:selectManyPickList>
> >
> >
> >
> > The "getUserSelectItems" method returns an array of SelectItems, each
> having
> > a value equal to a user object, and a label equal to the fullname of the
> > user.
> >
> >
> >
> > The problem: when submitting the form containing the Picklist, I get a
> > validation error   "j_id64:teamMembers: Validation Error: Value is not
> > valid"
> >
> >
> >
> > What is the correct way to handle this problem, as described in [1]?
> > Googling shows lots of explanations of the problem, but I haven't found
a
> > solution.   I've also tried using t:selectItems, and that causes the
same
> > problem.  Any suggestions would be greatly appreciated!
> >
> >
> >
> >
> >
> > Tim
> >
> >
> >
> > [1]
> >
>
http://www.crazysquirrel.com/computing/java/jsf/converter-validation-error.j
> spx
> >
>
>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to