`
healthandbeauty
  • 浏览: 165259 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

webwork 防止页面重复提交(增,删改)

阅读更多
看一下怎么实际运用(In Action):

1.定义你自己的拦截器栈:
   <interceptors>   
    <interceptor-stack name="submitToken">
     <interceptor-ref name="token-session"/>
     <interceptor-ref name="defaultStack"/> 
    </interceptor-stack>
   </interceptors>


2.在需要防止重复提交的action里添加刚刚定义的拦截器栈,像这样:
 
 <action name="sendMessage" class="net.jbbs.webwork.MessageAction" method="send">
    <result name="success" type="dispatcher">
     <param name="location">getMessagesList.action?type=sendbox</param>
    </result>
    <result name="fail" type="dispatcher">
     <param name="location">sendMessage.jsp</param>
    </result>
    <result name="invalid.token" type="dispatcher">
     <param name="location">sendMessage.jsp</param>
    </result>
    <interceptor-ref name="submitToken"/>
   </action>

3.修改相应的包含提交表单的jsp文件,在这里是sendMessage.jsp:
     <ww:token name="sendMessageToken"/>

做完上面三个步骤,应该可以实现防止重复提交了
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics