struts token 重复提交
在一个action中具有三个方法:
selectall(request,response,form,mapping)(转向的页面为a.jsp,分两部分:1.具有提交功能,可以设置表单。2.用来列出已经设好的信息。),delete(request,response,form,mapping)(在a.jsp页面的列表选项删除功能提交后进行删除操作);add(request,response,form,mapping)(添加功能)
try { allRecorders = crmDao.getCombototal(org); all = crmDao.getAllCombo(currentPage, lineSize, org); } catch (Exception e) { e.printStackTrace(); } saveToken(request);
if(!isTokenValid(request)){ saveToken(request); request.setAttribute("errormessage", "套餐已经删除,不能重复删除!"); return mapping.findForward("taocanexit"); }else{ crmDao.deleteTaocan(tcid); resetToken(request); return selectall(mapping, form, request, response); }
function doDel(tcid){ if( confirm("确认删除吗?")){ document.forms[0].method.value = "delete"; document.forms[0].tcid.value = tcid; document.forms[0].action = "/comboinit.do"; document.forms[0].submit(); } }