1, on the page
Copy Code code as follows:
<TD width= "4%" height= "align=" "Center" >
<input type= "checkbox" Name= "checkbox"
Value=<%=user.getid ()%>/>
</td>
2.action
Copy Code code as follows:
string[] checkbox = request.getparametervalues ("checkbox");
list<integer> Checkboxs = new arraylist<integer> ();
int Operatorid =sessionmgr.getaccountsession (request, Response). GetId ();
Logger.debug ("--operatorid--:" +operatorid);
Determine if the check box has a selection
if (checkbox!=null&&! "". Equals (checkbox)) {
for (int i=0;i<checkbox.length;i++) {
Checkboxs.add (Checkbox[i]);
String id_str = Checkbox[i];
int id = integer.parseint (ID_STR);
Judge whether it is oneself
if (Id==operatorid) {
Message= "Can not delete their own users";
}
Determine if admin super admin
if (id==1) {
Message= "Admin user cannot delete";
}
Determine if the user has a work list
Boolean isexist= false;
Isexist = Usermgr.isexistworkbillofuser (ID);
Logger.debug ("--isexist--:" +isexist);
if (isexist) {
Message = "The user has the construction bill can not be deleted";
}
if (id!=operatorid&&id!=1&&!isexist) {
Checkboxs.add (ID);
}
}
try{
Usermgr.deleteuser (CHECKBOXS);
message = "Delete Successful!" ";
}catch (SystemException se) {
Logger.error (SE);
}
}
else{
Message = "You haven't selected a user yet!" ";
}