JSTL c:forTokens Core Tag

The JSTL <c:forTokens> Core Tag is used for the iteration process. It breaks the string into tokens by using delimiter and then iterate through tokens.

Syntax:


          //block of statemtnts

c:forTokens tag attributes:

Attribute Description Required
items Information to loop over. No
begin Element to start with (0 = first item, 1 = second item, …). No
end Element to end with (0 = first item, 1 = second item, …). No
step Process every step items. No
var Name of the variable to expose the current item. No
varStatus Name of the variable to expose the loop status. No

Example:

test.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>


	
		c:forTokens JSTL core tag example
	
	
	 

Tokens passed in the String "sunil, bharat, richi" are:


web.xml


	
  
          test.jsp
  	


Output:

jsp example 39
 
Download this example.
 
Next Topic: JSTL c:url Core Tag with example.
Previous Topic: JSTL c:forEach Core Tag with example.