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>

解决方案 »

  1.   

    <input type="checkbox" name="id" value="id1">id1
    <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+")";
    %>
      

  2.   

    可以使用checkbox的name 或 value 属性放置你要传的值。
      

  3.   

    好象不对,checkbox没有选中时,它的value是不会提交的,
    getParameterValues只能得到选中的checkbox的value,选中
    两个的话,得到的数组只有两个元素