05array.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<%request.setCharacterEncoding("UTF-8"); %>
<%@include file="/WEB-INF/inc/header.jsp" %>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%@include file="/WEB-INF/inc/top.jsp" %>
<%
String[] array={"b","c","d"};
%>
<!-- " ", 변수 이름 그대로 사용하면 잘못된 것 -->
<c:forEach items="<%=array %>" var="i" varStatus="st">
${i } ${st.count }<br>
</c:forEach>
</body>
</html>
06collection.jsp
<%@page import="java.util.Map"%>
<%@page import="com.study.common.util.UserList"%>
<%@page import="com.study.login.vo.UserVO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<%request.setCharacterEncoding("UTF-8"); %>
<%@include file="/WEB-INF/inc/header.jsp" %>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%@include file="/WEB-INF/inc/top.jsp" %>
<%
List<UserVO> userList = new UserList().getUserList();
Map<String, UserVO> userMap = new UserList().getUsersMap();
/* for(Map.Entry<String, UserVO> entry : userMap.entrySet() ){
out.print(entry.getKey());
out.print(entry.getValue()); //entryValue : userVO
} */
%>
<c:set var="userList" value="<%=userList %>" />
<c:set var="userMap" value="<%=userMap %>" />
<c:forEach items="${userList }" var="user">
이름 : ${user.userName }, ID : ${user["userId"] },
pass : ${user.userPass }, role : ${user.userRole }
<br>
</c:forEach>
<hr>
<c:forEach items="${userMap }" var="entry">
${entry.key }
${entry.value } <!-- userVO -->
이름 : ${entry.value.userName } <br>
</c:forEach>
</body>
</html>