You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jimski <ji...@gmail.com> on 2008/01/15 02:38:55 UTC

OGNL makeNew

In the type conversion page on the wiki there's some discussion of
automagically creating new elements in a set.  I've been trying to get this
to work but haven't succeeded thus far.  Can anyone point me to a working
example of the collection.makeNew[index].property feature?

Unlike Map and List element properties, if fooCollection(22) does not exist,
it will not be created. If you would like it created, use the notation
fooCollection.makeNew[index] where index is an integer 0, 1, and so on.
Thus, parameter value pairs fooCollection.makeNew[0]=Phil and
fooCollection.makeNew[1]=John would add two new Foo Objects to fooCollection
-- one with name property value Phil and the other with name property value
Bar. However, in the case of a Set, the equals and hashCode methods should
be defined such that they don't only include the id property. Otherwise, one
element of the null id properties Foos to be removed from the Set.
-- 
View this message in context: http://www.nabble.com/OGNL-makeNew-tp14824681p14824681.html
Sent from the Struts - User mailing list archive at Nabble.com.


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