Hi, I've been getting an IndexOutOfBoundException on accessing a collection in one of my form beans.
The formbean is about this:
class Provider {
...
private List contacts = new ArrayList(...);
... then getter and setter (getContacts() and setContacts(List)
}
The JSP is:
<c:forEach items="${provider.contacts}" var="contact" varStatus="loopStatus">
<tr>
<td nowrap><b>Contact Name: </b></td>
<spring:bind path="provider.contacts[${loopStatus.index}].name">
<td><input type="text" name="<c:out value="${status.expression}"/>" value="<c:out value="${status.value}"/>"/></td>
<c:if test="${status.error}">
<c:forEach items="${status.errorMessages}" var="error">
<td><font color="red"><c:out value="${error}"/></font></td>
</c:forEach>
</c:if>
</spring:bind>
</tr>
The curious part is that if I replace that piece of the JSP by the below, it works.
<b><br/><c:out value="${fn:length(provider.contacts)}"/> contacts for this provider</b>
<c:out value="${provider.contacts[0].name}" />
Any ideas of what I might be doing wrong?
Thanks,
Gustavo Hexsel


Reply With Quote