12.4. Accessing the Loop Status

The forEach tag defines an optional status attribute that specifies the name of an attribute referring to an IteratorTagStatus object. This object provides details about the loop status. In particular, the IteratorTagStatus object has the following bean properties.

  • current. The current object, the same as you could obtain from the iteration variable that the var attribute specifies. This property corresponds to the getCurrent method and is of type Object.

  • index. The actual zero-based index of the current item within its data structure. This property corresponds to the getIndex method and is of type int.

  • count. The iteration number. This value starts at 1 and increases by 1 each time around the loop, regardless ...

Get More Servlets and JavaServer Pages™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.