Java Reference
In-Depth Information
The <c:forTokens> Action
The <c:forTokens> 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 . . . . . . . . .
</c:forTokens>
Table 3-18 describes all the attributes of <c:forTokens> .
Table 3-18. <c: for Tokens > 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 <c:forTokens> tag works with a string of characters separated by a delimiter. Listing 3-48 shows
the usage of <c:forTokens> .
Listing 3-48. Using <c: for Tokens>
<body>
<c:forTokens items="Clojure,Groovy,Java, Scala" delims="," var="lang">
<c:out value="${lang}"/><p>
</c:forTokens>
</body>
 
 
Search WWH ::




Custom Search