Sorry, the "status" attribute should be "varStatus"...

Quoting Kris Schneider <[EMAIL PROTECTED]>:

> <c:forEach var="entry" status="status" items="${myList}">
>   ...
>   <c:if test="${status.last}">
>     ...
>   </c:if>
> </c:forEach>
> 
> Quoting Ben Anderson <[EMAIL PROTECTED]>:
> 
> > Hi,
> > Is there a way for me to tell when I'm in the last iteration of a forEach?
> > 
> > <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
> > <jsp:useBean id="myList" class="java.util.ArrayList"/>
> > <%
> >   myList.add("1");
> >   myList.add("2");
> >   myList.add("3");
> > %>
> > <c:forEach var="entry" items="${myList}">
> > <!--  This is the last time through
> >       <c:if test="">
> >         do something special
> >       </c:if>
> > -->
> >   <c:out value="${entry}"/>
> >   <br />
> > </c:forEach>
> > 
> > I know it'd be better if my logic didn't need to know this, but I'm just
> > wondering if there's a way to do it.  I thought maybe I could get the size
> > and stick it in a var like
> > <c:set var="size" value="myList.xxx"/>
> > <c:forEach var="entry" items="${myList}" end="${size}>
> > 
> > but the size() method on java.util.Collection is just that, not getSize().
> > Any ideas?
> > Thanks,
> > Ben
> 
> -- 
> Kris Schneider <mailto:[EMAIL PROTECTED]>
> D.O.Tech       <http://www.dotech.com/>

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to