S
Stefan Siegl
Hello,
i was just wondering if there isn't a way to actually add a value to a
collection field of a bean. using <jsp:setProperty> you could only set
a "normal" field of the collection. I mean in JSP 2.0 with EL you now
have to ability to read values from a collection like ${foo[bar]}, so
why isn't there a possibility to add something to a collection. There
are a few workarounds i thought of:
1) use scriptlets:
<jsp:useBean name="foo" ...>
<% foo.add("test"); %>
2) create a custom tag to add a value to a bean like
<my:addBook beanVar="foo" bookName="bookname" />
why isn't there a standard way to do it like
3)
<c:add nameOfBean="foo" propertyName="bar" valueToAdd="test"/>
Thanks,
Stefan
PS: i hope this is the right NG but i did not find any on JSP
i was just wondering if there isn't a way to actually add a value to a
collection field of a bean. using <jsp:setProperty> you could only set
a "normal" field of the collection. I mean in JSP 2.0 with EL you now
have to ability to read values from a collection like ${foo[bar]}, so
why isn't there a possibility to add something to a collection. There
are a few workarounds i thought of:
1) use scriptlets:
<jsp:useBean name="foo" ...>
<% foo.add("test"); %>
2) create a custom tag to add a value to a bean like
<my:addBook beanVar="foo" bookName="bookname" />
why isn't there a standard way to do it like
3)
<c:add nameOfBean="foo" propertyName="bar" valueToAdd="test"/>
Thanks,
Stefan
PS: i hope this is the right NG but i did not find any on JSP