jstl forEach




<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ page import="java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<% List list = new ArrayList();
list.add("A"); list.add("P");
list.add("P"); list.add("L"); list.add("E"); %>
collection<br />
<c:forEach var="item" items="<%=list%>">
<c:out value="${item}"/>
</c:forEach>
<br />step<br />
<c:forEach var="item" begin="1" end="10" step="1" >
${item}
</c:forEach>

<br />varStatus<br />
<c:forEach var="item" begin="1" end="10" step="1" varStatus="vs">
index[${vs.index}]&nbsp;&nbsp;
count[${vs.count}]&nbsp;&nbsp;
begin[${vs.begin}]&nbsp;&nbsp;
end[${vs.end}]&nbsp;&nbsp;
step[${vs.step}]&nbsp;&nbsp;
first[${vs.first}]&nbsp;&nbsp;
last[${vs.last}]&nbsp;&nbsp;
current[${vs.current}]&nbsp;&nbsp;<br />
</c:forEach>
<br /><pre>
index : 반복에서 현재 인덱스 ex)vs.index
count : 반복 횟수 ex) vs.count
begin : 시작 값
end : 마지막 값
step : 반복의 증감치
first :현재 실행이 반복의 처음이면 true
last : 현재 실행이 반복의 마지막이면 true
current : 컬렉션 중 현재 반복에서 사용할 객체
</pre>
</body>
</html>

JSTL tag ex)  : https://ahnsk39.blogspot.com/2017/08/jstljsp-standard-tag-library.html

Popular posts from this blog

youtube download

com.gpki.secureweb.GPKISecureWEBException: ErrCode=1507,ErrMsg=[GPKI_CMS_ProcessEnvelopedData] 해당 인증서로는 데이터를 풀 수 없습니다.

rexpert 공식필드(javascript) 점검일 주기 계산