Java Reference
In-Depth Information
Looping and Iteration
JSTL offers two useful actions for looping and iteration: <c:forEach> for general data and
<c:forTokens> for string tokenizing.
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 <c:forEach>Action
The <c:forEach> action iterates over a collection of objects.
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 . . . .
</c:forEach>
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 . . .
</c:forEach>
Table 3-17 illustrates the attributes of the <c:forEach> action.
 
 
Search WWH ::




Custom Search