<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!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=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<form method="post" action="Intro06pro.jsp">

노래 1 : <input type="text" name="sing"><p/>

노래 2 : <input type="text" name="sing"><p/>

노래 3 : <input type="text" name="sing"></p>

<input type="submit" value="확인">

</form>


</body>
</html>

************    Intro06pro.jsp     ****************
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!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=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("euc-kr");
%>
노래
<%
//문자열 배열로 받아서 반복하여 출력할것..
//★ 다중선택형 입력양식요소의 경우 선택하지 않은 요소는 값으로 넘어오지 않지만,
//아래와 같이 이름이 같은 단순텍스트상자의 경우 기입하지 않은 입력양식요소의 값도
//빈문자열로 전달된다.
String[] sings =request.getParameterValues("sing");
for(int i=0;i<sings.length;i++)
{
 out.println(sings[i]+", ");
}

out.println("갯수 : "+sings.length);
%>
</body>
</html>

Posted by 말없제이
,