728x90
반응형
JSTL 문법 forEach 알아보기
0 ~ 5 까지 출력하기 (default step = 1)
1
2
3
4
5
6
|
<c:forEach var="index" begin="0" end="5">
${index }
</c:forEach>
실행 결과 : 0 1 2 3 4 5
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
0 ~ 5 까지 출력하기 (step = 2)
1
2
3
4
5
6
|
<c:forEach var="index" begin="0" end="5" step="2">
${index }
</c:forEach>
실행 결과 : 0 2 4
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
리스트 순차적으로 사용하기
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<c:set var="index" value="0,1,2" />
<c:forEach items="${index }" var="temp">
<p>인덱스 : ${temp }<p>
</c:forEach>
실행결과
-----------------------
인덱스 : 0
인덱스 : 1
인덱스 : 2
-----------------------
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
728x90
반응형
'Web > JSP' 카테고리의 다른 글
[JSP] js, css import example (0) | 2019.07.07 |
---|---|
[JSP] JSTL if, when, otherwise Example (1) | 2019.07.07 |
[JSP] JSTL Tag 사용 Error (0) | 2019.07.07 |