多選框批量刪除後臺程式碼
阿新 • • 發佈:2019-01-25
/**
*公告管理--可批量刪除
* @throws IOException
*/
@RequestMapping(value="delete_notice", method=RequestMethod.POST, produces="text/json;charset=utf-8")
@ResponseBody
public Object delete_notice(HttpServletRequest request,HttpServletResponse response) throws IOException{
String items = request.getParameter("noticeId");
String[] strs = items.split(",");
JSONObject data = new JSONObject();
for (int i = 0; i < strs.length; i++) {
int notices = Integer.parseInt(strs[i]);
int n = this.noticeService.delete_notice(notices);
if (n > 0) {
data.put("data", "1");
}else {
data.put("data", "操作失敗");
}
}
response.sendRedirect("knowledge_admin.html");
return data.toString();
}
*公告管理--可批量刪除
* @throws IOException
*/
@RequestMapping(value="delete_notice", method=RequestMethod.POST, produces="text/json;charset=utf-8")
@ResponseBody
public Object delete_notice(HttpServletRequest request,HttpServletResponse response) throws IOException{
String items = request.getParameter("noticeId");
String[] strs = items.split(",");
JSONObject data = new JSONObject();
for (int i = 0; i < strs.length; i++) {
int notices = Integer.parseInt(strs[i]);
int n = this.noticeService.delete_notice(notices);
if (n > 0) {
data.put("data", "1");
}else {
data.put("data", "操作失敗");
}
}
response.sendRedirect("knowledge_admin.html");
return data.toString();
}