You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@raibledesigns.com> on 2005/05/08 17:39:15 UTC

Indexed Properties with Sets

I've had much success doing indexed properties with a java.util.List, 
but no luck with figuring out how to do it with a java.util.Set.  Is it 
possible?  With a list, you can use the setProperty(index i, ActionForm 
form) signature, but I haven't been able to figure out how to do this 
with a Set.  Is anyone doing this?

As an alternative, I suppose I could modify my Form -> POJO conversion 
to detect Sets and properly convert List to Set.

Thanks,

Matt


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Indexed Properties with Sets

Posted by Rick Reumann <st...@reumann.net>.
Matt Raible wrote the following on 5/8/2005 11:39 AM:

> As an alternative, I suppose I could modify my Form -> POJO conversion 
> to detect Sets and properly convert List to Set.

Unfortunately I think this is what you are going to have to do Matt. I'd 
  keep the Set property in the form bean, but use the List property in 
the html:

//ActionForm

Set someSet;
List someList;

getSomeList {
    //*gets someList from the someSet
}

setSomeList
    //sets someList
    //*also populates someSet from someList

setSomeSet
    //sets someSet

getSomeSet
    //gets someSet

Now the above should work even if your Value Object has a Set property.


-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org