当点击删除按钮是调用deletes()方法。并把删除列的id号从后台作为参数传入。在该方法中调用confirm()实现弹窗效果。当点击确定按钮时,返回true,当返回true,调用ajax请求页面中的delete方法。返回的数据填充到body中。
@RequestMapping(value = “/delete”)
public ModelAndView delete(Integer id){
try{
System.out.println(“delete”+id);
pageService.delete(id);
}catch(Exception e) {
e.printStackTrace();
}
/return super.returnModel(“”);/
return new ModelAndView(“redirect:/page/list”);
}
public void **delete**(PK id) {
Session session = this.getSession();
try {
Serializable e = this.load(id);
if(e != null) {
session.delete(e);
session.flush();
}
} catch (Exception var7) {
var7.printStackTrace();
} finally {
this.returnSession(session);
}
}