<c:forTokens items="${requestScope.tokenising}" delims="!," var="tokenName" varStatus="status">. This tag is used is for making tokens a string. It iterates over tokens generated, which is separated by the supplied delimiters.
Description of the attributes we have used in this tag has been given below:
items: It contains the string which is having the tokens on which the iterate will happen.
delims: It contains the characters which will separate the tokens in the string.
var: It is the name of the exported scoped variable for the current item of the iteration.
varStatus: Name of the exported scoped variable for the status of the iteration. The varStatus attribute makes a new variable that holds an instance of javax.servlet.jsp.jstl.core.LoopTagStatus.
The code of the program is given below:
| <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <c:set var="tokenising" value="Welcome! to, the, site, of : roseindia.net" scope="request" /> <html> <head> <title>How to use forToken Tag</title> </head> <body> <c:forTokens items="${requestScope.tokenising}" delims="!," var="tokenName" varStatus="status"> The tokens generated is of number : <c:out value="${status.count}" /> <c:out value="${tokenName}" /> <br /> </c:forTokens> </body> </html> |
The output of the program is given below:

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss:
Post your Comment