try:<%@ page contentType="text/html;charset=gb2312"%>
<%
String[] sStr = request.getParameterValues("chk") ;
if (sStr!=null&&sStr.length>0){
for(int i=0;i<sStr.length;i++)
out.print(sStr[i]+"<br>") ;
}
%>
<form name=f method=post>
<input type=checkbox checked name=chk value=abc>
<input type=checkbox checked name=chk value=def>
<input type=checkbox checked name=chk value=jhi>
<input type=checkbox checked name=chk value=mnk>
<br>
<input type=submit name=b>
</form>
<%
String[] sStr = request.getParameterValues("chk") ;
if (sStr!=null&&sStr.length>0){
for(int i=0;i<sStr.length;i++)
out.print(sStr[i]+"<br>") ;
}
%>
<form name=f method=post>
<input type=checkbox checked name=chk value=abc>
<input type=checkbox checked name=chk value=def>
<input type=checkbox checked name=chk value=jhi>
<input type=checkbox checked name=chk value=mnk>
<br>
<input type=submit name=b>
</form>
<input type="checkbox" name="id" value="id2">id2
<input type="checkbox" name="id" value="id3">id3
<input type="checkbox" name="id" value="id4">id4<%
String s[] = request.getParameterValues("yourSelect");
String str="";
for (int i=0; i<=s.length; i++)
{str = str + "'" + s[i]+"'";}
String sql="delete table1 where id in ("+str+")";
%>
getParameterValues只能得到选中的checkbox的value,选中
两个的话,得到的数组只有两个元素