Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL forEach syntax

 
ajithsasi kumar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the forEach syntax what does varstatus means
 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"varstatus" attribute in forEach will give you an index of the element in iterating List.


For first iteration its value will be 1
For second iteration its value will be 2..
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a bit more than that. varStatus gives you access to a scoped variable whose type is javax.servlet.jsp.jstl.core.LoopTagStatus.
If you look at this class API, you'll see that it allows you to get more information about the loop.
 
Anirvan Majumdar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd also recommend this site for clearing up any doubts you might have about the for-each tag. All attributes of this tag are quite clearly explained.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic