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


 
Ads

<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

Ads
Share on Google+Share on Google+

Posted on: March 12, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss:  

Post your Comment


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

Thanks Very nice and clear

Ads

 

Ads