日期:2014-05-17 浏览次数:20792 次
public static boolean isTokenStringValid(String tokenStr, HttpSession session) {
boolean valid = false;
if(CommUtil.isBlank(tokenStr))
valid=true;
if(session != null){
ArrayList tokenList = getTokenList(session);
if (tokenList.contains(tokenStr)) {
valid = true;
tokenList.remove(tokenStr);
}
}
return valid;
}
public ActionForward executeAct(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception {
String token=req.getParameter("token");
logger.debug("----------token:"+token);
if(!Token.isTokenStringValid(token, req.getSession())){
//进行防重复提交处理流程 非法操作,请勿重复提交!
System.out.println("---------------重复提交");
saveErrors(req, ErrMsg.getActionError(new AppException("resubmit")));
return mapping.findForward("failure");
}
//此处是框架封装的方法,业务逻辑统一放到这里去操作,然后返回 forward进行跳转
//forward里有调用其它逻辑类的方法。
Dto returnVO = bo.exec(topicName, funcName, aDto, stBean);
LazyDynaBean returnBean = new LazyDynaBean();
DtoUtil.copyPropertys(returnBean, returnVO);
try {
BeanUtils.copyProperties(execForm, returnBean);
} catch(Exception ee){}
req.setAttribute("returnBean", returnBean);
req.setAttribute("returnDto", returnVO);
req.setAttribute("gctBean", returnVO);
String output_forward = ForwardUtil.getOutputForward(returnVO, execForm, topic_func_bean, null);
String append_url = null;
append_url = GctUtilNew.getKeyUrl(topicBean, returnVO);
ActionForward actionforward = ForwardUtil.createForward(bo, mapping, output_forward, append_url, false);
return actionforward;
}
//清空params
req.getParameterMap().clear();