본문 바로가기
Developer/HTML & JSP & CSS

[JSP] JSTL에서의 인덱스 사용방법

by 순수한소년 2017. 1. 21.
728x90
반응형

출처

http://marobiana.tistory.com/9


 - JSTL에서의 인덱스 사용방법부터!!!


<c:forEach items="${modelData}" var="list" varStatus="status">

${status.count}<br/>

</c:forEach>


이렇게 하면 포가 돌때마다 카운트가 증가한다.

만약 5번 돌았다면,

1

2

3

4

5 가 출력됐을것이다.


${status.count} 말고도 다른것도 있다.

${status.index} 라고 쓰면 0부터 시작이 된다.  (count는 1부터 시작)



출처: http://marobiana.tistory.com/9 [Take Action]



728x90
반응형