JSTL - jstl core forEach
<prefix:forEach> ये tag दिए गए body content को किसी विशिष्ट वक्त तक iterate करता रहता है |
ये tag while और for Loop के जैसा होता है |
Syntax for <prefix:forEach> in JSTL
<prefix:forEach var="variable_name" begin="beg_value" end="end_value"> -------- </prefix:forEach>
<prefix:forEach> Attribute in JSTL
var : यहाँ पर variable name दिया जाता है | इस variable के जरिये iteration होता रहता है |
begin : यहाँ पर शुरूआती value दी जाती है | इस value से iteration होना start होता है |
end : यहाँ पर आखिरी value दी जाती है | इस value पर iteration; end होता है |
Example for <prefix:forEach> Tag in JSTL
Source Code :Output :<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <c:forEach var="i" begin="0" end="10"> <c:out value="${i}"/><br /> </c:forEach>
0 1 2 3 4 5 6 7 8 9 10