Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on Tags

 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Enthuware, it is mentioned that for looping over collections, a loop status object might be used in the tag body. How do we use the loop status object in the tag body?

Thanks in advance.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which tags are you talking about ? JSTL's iteration tags ? (c:forEach, c:forTokens)
 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am talking about c:forEach tags.

Thanks in advance.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we use the loop status object in the tag body?

There is a varStatus attribute in the c:forEach tag. It's type is javax.servlet.jsp.jstl.core.LoopTagStatus. If you look at the LoopTagStatus API, you'll see that the following information is available : begin, count, current, end, index, step.
For example, the following will print the iteration count next to an album title :
 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Verre,

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic