• struts1与struts2的防止表单重复提交


    struts1的防止表单重复提交

    一、方法:利用令牌来解决页面重复提交的问题

    二、步骤

      2.1  Action中需要添加以下代码

        

    public ActionForward entry(ActionMapping mapping, ActionForm form,  
               HttpServletRequestrequest, HttpServletResponse response)  
               throws Exception {  
           saveToken(request);  
           return mapping.findForward("showAll");  
        }  
        public ActionForward  update(ActionMapping mapping, ActionForm form,  
               HttpServletRequestrequest, HttpServletResponse response)  
               throws Exception {  
           if (isTokenValid(request, true)) {  
               UserForm actionForm=(UserForm)form;  
               .................
               return mapping.findForward("success");  
           }else{  
               saveToken(request);  
               return mapping.findForward("error");  
           }  
            
        }      

      2.2 jsp页面必须用struts1标签表单

     

    <%@ taglib uri="http://struts.apache.org/tags-html"  prefix="html" %>
    <html:form action="User" method="post">
    '''''''''''''
    </html:form>
  • 相关阅读:
    terminator shortcut
    支付宝集成错误
    null与DBNULL
    linode接连出问题,我也没看懂英文
    ruby 日期 好函数
    ruby datetime
    act as tree插件
    ruby 时间
    ruby规则引擎
    on ,type等关键词,使用
  • 原文地址:https://www.cnblogs.com/tombsky/p/3899247.html
Copyright © 2020-2023  润新知