Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to iterate through an ArrayList of strings using <c:forEach/>?

843838Oct 24 2005 — edited Oct 25 2005
Hello, 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 22 2005
Added on Oct 24 2005
4 comments
152 views