Programming/[JSP]

[JSTL] for tokens를 forEach로 바꾸기

iD이드 2018. 5. 5. 14:59

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!-- 
    <%
        for(String item : eltest.getProductList()) {
            out.println("<option>"+item+"</option>");
        }
    %>
     -->
 
    <!-- for tokens를 for each로 -->
    <c:forEach items="${eltest.getProductList() }" var="i" begin="0" end="4" step="1">
        <option>${i}</option>    
    </c:forEach>
 
    <!-- 
    <c:forEach items="${배열이름 }" var="사용할 변수" begin="시작점" end="끝점" step="증가수">
        <option>${i}</option>    
    </c:forEach>
     -->
cs