Woodchuck wrote:
hihi,
i have a jsp with the following:
<c:forEach var="i" begin="0" end="5">
<html-el:text name="MyObj" property="foo[${i}].bar"/>
</c:forEach>
in MyObj i have these methods:
public Collection getFoo() {
return foo;
}
public Bar getFoo(int i) {
while(i >= foo.size()) {
((ArrayList)foo).add(new Bar());
}
return (Bar)((ArrayList)foo).get(i);
}
when i request for the jsp, it calls the first getFoo() method. should
it not call the second getFoo(int) method instead, since the jsp is
using jstl to provide an index parameter?
the weird part is when i take out the getFoo() method and recompile,
then the jsp calls getFoo(int) correctly.
why is the behavior like this? is this a bug?
(when it calls the first getFoo() method i get an indexOutOfBounds
exception because my foo collection has nothing in it... i want the
collection size to be driven by the jsp page)
thanks in advance,
woodchuck
You might take a look at the .java file your JSP is compiled into, for
an understanding of what exactly is going on. Stepping through it in a
debugger might help as well.
--
Brice Ruth, Sr. IT Analyst
Fiskars Brands Inc
http://www.fiskarsbrands.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]