138 CHAPTER 3: Best Practices in Java EE Web Development
Looping and Iteration
JSTL offers two useful actions for looping and iteration:
Table 3-16 illustrates the actions for looping and iteration.
Table 3-16. Looping and Iteration Actions in the Core Tag Library
Action Description
<c:forEach> Iterates over a collection of objects
<c:forTokens> Iterates over tokens, separated by the supplied delimiters
The
The
Here’s the syntax for iterating over a collection of objects:
<c:forEach[var="varName"] items="collection"
[varStatus="varStatusName"]
[begin="begin"] [end="end"] [step="step"]>
... body content....
Here’s the syntax for iterating a fixed number of times:
<c:forEach [var="varName"]
[varStatus="varStatusName"]
begin="begin" end="end" [step="step"]>
.... body content...
Table 3-17 illustrates the attributes of the