Learn Java for Web Development

(Tina Meador) #1

140 CHAPTER 3: Best Practices in Java EE Web Development


The Action


The action iterates over a string of tokens separated by a set of delimiters.


Here’s the syntax:


<c:forTokens items="stringOfTokens" delims="delimiters"
[var="varName"] [varStatus="varStatusName"]
[begin="begin"] [end="end"] [step="step"]>


... body.........



Table 3-18 describes all the attributes of .


Table 3-18. Attributes


Name Type Description

var String Name of the exported scoped variable for the current item of the iteration.
items String String of tokens to iterate over.
delims String Set of delimiters (the characters that separate the tokens in the string).
varStatus String Name of the exported scoped variable for the status of the iteration. The object
exported is of type javax.servlet.jsp.jstl.core.LoopTagStatus.
begin int Iteration begins at the token located at the specified index. The first token has index 0.
end int Iteration ends at the token located at the specified index (inclusive).
step int Iteration will process only every step tokens, starting with the first one.

The tag works with a string of characters separated by a delimiter. Listing 3-48 shows
the usage of .


Listing 3-48. Using






Free download pdf