HashMap/ArraryList 값 꺼내기
서블릿에서 hashmap이나 arrarylist에 저장해서 넘겨준 값을 jsp 단에서 꺼내는 방법
arraylist
특정 인덱스의 변수 값을 가져오기
${DTOList[0].product}
forEach 문으로 반복해서 가져오기
<c:forEach var="list" items="${DTOList}">
<tr>
<td>${list.testId}</td>
<td>${list.phase}</td>
<td>${list.os}</td>
<td>${list.status}</td>
<td>${list.tester}</td>
<td>${list.date}</td>
</tr>
</c:forEach>
hashmap
key 값 꺼내기
<c:forEach var="product" items="${productInfo}">
<c:choose>
<c:when test="${product.key == defaultProduct}">
<option selected>${product.key}</option>
</c:when>
<c:otherwise>
<option>${product.key}</option>
</c:otherwise>
</c:choose>
</c:forEach>
key 값을 기준으로 value 꺼내기
<c:forEach var="product" items="${productInfo}">
<c:choose>
<c:when test="${product.key == defaultProduct}">
<c:forEach var="version" items="${product.value}">
<option selected>${version}</option>
</c:forEach>
</c:when>
</c:choose>
</c:forEach>
contextpath 불러오기
호출할 페이지 또는 참고하는 파일의 위치를 path를 절대 경로로 주는 경우에 contextpath가 변경될 수도 있다는 가정하에.. 직접적으로 명시하지 않고 request 객체에 저장된 contextpath를 참조하여 경로 명시하는 방법
<!-- c:set 이거 쓰려면 명시해줘야한다. jstl 라이브러리 다운받아서 WEB-INF/lib 에 넣어줘야함. -->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!-- contextpath 가져와서 변수 정의 하고.. -->
<c:set var="contextPath" value="<%= request.getContextPath()%>"></c:set>
아래와 같이 사용 하면 됨.
<!-- script 정의 시 -->
<script src="${contextPath}/res/js/date/jquery-1.10.2.js"></script>
<!-- script 내부에서 -->
<script>
alert("${contextPath}");
</script>
<!-- html body 에서 -->
<body>
contextPath : ${contextPath}
</body>
</html>