1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
一、将前台jsp页面中的所有你要用到checkbox的name值设为相同,如 <input type= "checkbox"
name= "userid" >
二、在后台获取参数时,使用数组获取: String userid[] = request.getParameterValues( "userid" );
String userIdAll = "" ;
三、进行数组必要的格式转换,再进行sql操作 if
(userid!= null )
{ for ( int
i= 0 ;i<userid.length;i++)
{
userIdAll = userIdAll + userid[ 0 ] + ","
;
}
userIdAll = userIdAll.substring( 0 , userIdAll.length- 1 )
String sql = "delete reguser where userid in("
+ userIdAll+ ")" ;
//执行sql语句
} |