struts2防止重复提交问题

来源:互联网 发布:怎样看是不是淘宝客 编辑:程序博客网 时间:2024/05/16 10:02
首先在struts配置文件中加入以下代码:<action name="fund_audit" class="com.gsww.faimis.web.action.fund.FundAction" method="audit">         <interceptor-ref name="token"/>         <interceptor-ref name="params"/>         <result name="success_region" type="redirect">/finance/fund/region_audit_list.jsp</result>         <result name="invalid.token">/finance/fund/region_audit_list.jsp</result></action>其中<interceptor-ref name="token"/>和<interceptor-ref name="params"/>是两个拦截器的配置,目的是为了接收页面传入的token令牌及参数,<result name="invalid.token">/finance/fund/region_audit_list.jsp</result>指当发现重复提交时,需要流转到的页面。然后在JSP页面头部中加入<%@ taglib prefix="s" uri="/struts-tags" %>引入struts标签库最后在JSP页面<form></form>中加入这一行:<s:token/>,产生token令牌,提交到Action进行验 
原创粉丝点击