반응형

<%@ page language="java" contentType="text/html; charset=UTF-8"

pageEncoding="UTF-8"%>



<!-- ArrayList 클래스를 사용하기 위한 import -->

<%@ page import="java.util.*"%>


<!-- 정수를 저장하는 Arraylist를 생성하고 데이터 추가 -->

<%

ArrayList<Integer> al = new ArrayList<Integer>();


al.add(10);

al.add(30);

al.add(15);

%>



<!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>ArrayList 출력</title>

</head>

<body>

<%

for (int i = 0; i < al.size(); i++) {

int imsi = al.get(i);

%>

<%=imsi%><br />

<%

}

%>



</body>

</html>

+ Recent posts