forEach태그에는 var , items , begin , end , step 의 속성이 있다.
status객체의 이름을 status로 잡고 getter 프로퍼티로 끌어다쓰는 듯 하다. 즉 상태를 알려주는 객체인듯 하다.
-
${status.current} 현재 for문의 해당하는 번호
-
${status.index} 해당 인덱스넘버
-
${status.count} 출력 카운트
-
${status.first} 첫 번째인지 여부 >>>> c:if 의 test 속성에 쓰이는 듯함
-
${status.last} 마지막인지 여부 >>>> c:if 의 test 속성에 쓰이는 듯함
-
${status.begin} for문의 시작 번호
-
${status.end} for문의 끝 번호
-
${status.step} for문의 증가값
<body>
<%--
forEach의 varStatus 속성
(javax.servlet.jsp.jstl.core.LoopTagStatus)
--%>
<%
String[] arr ={"java","script","css","python","matrix","c++"};
request.setAttribute("arr", arr);
%>
<table class="table" border="1" style="border-collapse: collapse;">
<tr>
<th>index</th>
<th>count</th>
<th>item</th>
</tr>
<c:forEach var="item" items="${arr}" varStatus="status" begin="3">
<tr>
<td>${status.index }</td>
<td>${status.count }</td>
<td>${item }</td>
</tr>
</c:forEach>
</table>
</body>
'EL' 카테고리의 다른 글
11.pagenation 예제 (0) | 2020.07.15 |
---|---|
10.forEach - c:set으로 변수를 선언하고 사용하기. (0) | 2020.07.15 |
8.forEach태그의 Map 컬렉션 추출 (0) | 2020.07.15 |
7.JSTL-forEach의 태그와 기본속성. (0) | 2020.07.15 |
6.JSP 에서 static 메서드 호출 (0) | 2020.07.14 |