<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
java.util.List<String> seasonList = new java.util.ArrayList<String>();
seasonList.add("봄");
seasonList.add("여름");
seasonList.add("가을");
seasonList.add("겨울");
pageContext.setAttribute("list", seasonList);
%>
<select name="selectSeason">
<c:forEach var="season" items="${list }" varStatus="status">
<option value="${season }">${season }</option>
</c:forEach>
</select>
<hr>
<c:forEach var="season" items="${list }" varStatus="status">
${season }
</c:forEach>
</body>
</html>
728x90
반응형
'JSP, Servlet > JSP, Servlet 기초' 카테고리의 다른 글
[JSP] fmt태그 사용하기 (<fmt:setTimeZone>, <fmt:timeZone>, <fmt:setLocale> ) (0) | 2020.08.14 |
---|---|
[JSP] fmt태그 사용하기(<fmt:formatDate>) (0) | 2020.08.14 |
[JSP] fmt태그 사용하기(<fmt:formatNumber>) (0) | 2020.08.14 |
[JSP] fmt태그 이용하기 기초 (0) | 2020.08.14 |
[JSP] c태그 사용하기(<c:catch>) (0) | 2020.08.14 |