Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
How to apply forEach tag in JSP?
The
Attribute
The
| Attribute | Description | Required | Default |
|---|---|---|---|
| items | Information to loop over | No | None |
| begin | Element to start with (0 = first item, 1 = second item, ...) | No | 0 |
| end | Element to end with (0 = first item, 1 = second item, ...) | No | Last element |
| step | Process every step items | No | 1 |
| var | Name of the variable to expose the current item | No | None |
| varStatus | Name of the variable to expose the loop status | No | None |
Example for
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<html>
<head>
<title><c:forEach> Tag Example</title>
</head>
<body>
<c:forEach var = "i" begin = "1" end = "5">
Item <c:out value = "${i}"/><p>
</c:forEach>
</body>
</html>
The above code will generate the following result ?
Item 1 Item 2 Item 3 Item 4 Item 5
Advertisements
