How to iterate through an ArrayList of strings using <c:forEach/>?
843838Oct 24 2005 — edited Oct 25 2005Hello, I have an ArrayList of error messages within a JavaBean:
private ArrayList errorAL;
public ArrayList getErrorAL() {
return errorAL;
}
I would like to iterate and display each of the error messages in the ArrayList using the <c:forEach/> JSTL tag, but I haven't been able to find a way of doing so.
These two scriptlets work fine in my JSP, so I know it is reading the ArrayList properly:
<%= signOnBean.getErrorAL().toString() %>
<%= "size: " + signOnBean.getErrorAL().size() %>
But my <c:forEach/> is completely wrong -- nothing is working with it:
<c:forEach items="${signOnBean.errorAL}" var="errorItem">
<tr><td><c:out value="${errorItem}"/></td></tr>
</c:forEach>
Anyone know what I'm doing wrong?
Thanks,
Glen