FruitsInput.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList"%>
<%
ArrayList<String> items = new ArrayList<String>();
items.add("딸기");
items.add("오렌지");
items.add("복숭아");
request.setAttribute("fruits", items);
RequestDispatcher dispather = request.getRequestDispatcher("FruitsView.jsp");
dispather.forward(request, response);
%>
FruitsView.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>익스프레션 : List 객체 항목 출력</title>
</head>
<body>
<h3>이번달 과일 판매 순위</h3>
1위. ${fruits[0] }<br>
2위. ${fruits[1] }<br>
3위. ${fruits[2] }<br>
</body>
</html>
'JAVA > JSP & Servlet' 카테고리의 다른 글
익스프레션 언어(expression language) JavaBean 객체 (0) | 2013.03.21 |
---|---|
익스프레션 언어(expression language) HashMap (0) | 2013.03.21 |
익스프레션 언어(expression language) empty (0) | 2013.03.21 |
익스프레션 언어(expression language) 산술, 비교, 논리, 조건 -param- (0) | 2013.03.21 |
익스프레션 언어(expression language) -cookie- (0) | 2013.03.21 |