본문 바로가기

Programming/[JSP]

[JSTL] for tokens를 forEach로 바꾸기

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

 

'Programming > [JSP]' 카테고리의 다른 글

[WEB] 크롤링(HTTrack)  (0) 2018.05.08
[JSTL] SQL 태그  (0) 2018.05.05
[JSP] 톰캣으로 프로젝트 실행시 시작페이지 설정  (0) 2018.05.03
[JSP] 썸네일 만들기  (0) 2018.05.01
[JSP] 파일 업로드 기초  (0) 2018.05.01