On Wed, 22 Sep 2004 15:43:09 -0400, Kris Schneider [EMAIL PROTECTED] wrote:
c:forEach var=entry status=status items=${myList}
That would be 'varStatus' rather than 'status'. ;-)
--
Martin Cooper
...
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/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]