, tag
These tags encapsulate the for, while, and do-while loops in Java.
By comparison, the
forEach Syntax
...
forTokens Syntax
property
| property | Description | Whether it is required | Default value |
|---|---|---|---|
| items | The information to be looped over | No | None |
| begin | The starting element (0 = first element, 1 = second element) | No | 0 |
| end | The last element (0 = first element, 1 = second element) | No | Last element |
| step | The step size of each iteration | No | 1 |
| var | The name of the variable representing the current item | No | None |
| varStatus | The name of the variable representing the loop status | No | None |
| property | Description | Whether it is required | Default value |
|---|---|---|---|
| delims | Separators | Is | None |
Example Demonstration
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
c:forEach 标签实例
Item
The running result is as follows:
Item 1
Item 2
Item 3
Item 4
Item 5
Demo Example
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
c:forTokens 标签实例
The running result is as follows:
google
runoob
taobao
JSP Standard Tag Library