Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Advertisement
. This tag is used is for making tokens a string. It iterates over tokens generated, which is separated by the supplied delimiters.

<c:forTokens>

        

<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:

Download this example.

Advertisements

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 12, 2008

Ask Questions?    Discuss:  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
Ahmed Adel
May 6, 2013
Thanks

Thanks Very nice and clear
DMCA.com