|
|
forTokens in JSP Core Tag Library
|
Tutorials

Jsp

|
Topic |
What is "forTokens" tag in JSP Core Tag Library?
|
|
Explanation |
|
The forTokens tags is used to iterate the strings tokenized by the delimiters specified by the
"delims" attribute. In each iteration the current token will be stored with the "var" attribute.
Syntax:
<c:forTokens var="name" items="expression" delims="expression"
begin="expression" end="expression" step="expression">
body
</c:forTokens>
In the above example the values given in the "items" attribute seperated by the delimiter given in the
"delims" attribute are tokenized and iterated based on the values of "begin", "end", "step" attributes.
Example:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<p>Example for forToken in Core Tag Library.</p>
<c:forTokens var="token" items="apple#banana&capsicum,eggfruit"
delims=",&">
<c:out value="${token}"/>
</c:forTokens>
Result::
Example for forToken in Core Tag Library.
apple#banana capsicum eggfruit
In the above example we have used the delimiters ",", "&" to tokenize the string.
|
|
A Note |
|
JSP(Java Server Pages) is one of the most used Server Side Programming Language in the world. Simple introduction, basic program codes with examples. Begin coding your own JSP scripts with this online tutorial. Hope you enjoy this tutorial. Do send your feedback or suggestions on this JavaServer Pages tutorial. This is a copyright content.
|
|
|
|