반응형
SMALL
보내는 html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
</head>
<body>
<table width="630" border="0" cellspacing="0" cellpadding="0">
<form name="frm" method="POST" action="checkbox.jsp">
<tr>
<td> 체크박스1: <input name="chkbox" type="checkbox" value="1"></td>
<td> 체크박스2: <input name="chkbox" type="checkbox" value="2"></td>
<td> 체크박스3: <input name="chkbox" type="checkbox" value="3"></td>
<td> 체크박스4: <input name="chkbox" type="checkbox" value="4"></td>
<td> 체크박스5: <input name="chkbox" type="checkbox" value="5"></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td align="center" colspan="5"><input name="button" type="submit" value="보내기"></td>
</tr>
</form>
</table>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
</head>
<body>
<table width="630" border="0" cellspacing="0" cellpadding="0">
<form name="frm" method="POST" action="checkbox.jsp">
<tr>
<td> 체크박스1: <input name="chkbox" type="checkbox" value="1"></td>
<td> 체크박스2: <input name="chkbox" type="checkbox" value="2"></td>
<td> 체크박스3: <input name="chkbox" type="checkbox" value="3"></td>
<td> 체크박스4: <input name="chkbox" type="checkbox" value="4"></td>
<td> 체크박스5: <input name="chkbox" type="checkbox" value="5"></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td align="center" colspan="5"><input name="button" type="submit" value="보내기"></td>
</tr>
</form>
</table>
</body>
</html>
받는 JSP
<%
String[] chkbox = request.getParameterValues("chkbox");
for( int i = 0; i < chkbox.length; i++ )
{
out.println(chkbox[i]);
}
%>
반응형
'Web Programing! > JAVA / JSP' 카테고리의 다른 글
[JSP] 8자리 랜덤문자 생성 코드 (0) | 2011.09.14 |
---|---|
[JSP] request.getHeader() 메소드 (0) | 2011.09.14 |
[JSP] 자릿수 만들기 - DecimalFormat() (0) | 2011.09.14 |
[JSP] split() - 구분자로 나눠진 값들 배열로 나누기 (0) | 2011.09.14 |
[JSP] 날짜 구하기 - 여러가지 방법 (1) | 2011.09.13 |
[JSP] rs.next() 설명 (1) | 2011.09.13 |
[JSP] 방문카운트 (0) | 2011.09.13 |