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