struts2--使用标签防止重复提交

时间:2023-01-05 17:46:34

取个小例子:
这是网页:

<body>

<s:actionerror/>

<s:form action="LoginAction" method="post">

<s:token></s:token>

<s:textfield name="produ" label="预定产品的编号" />

<s:textfield name="onum" label="预定数量" />

<s:submit value="提交"></s:submit>

</s:form>

</body>

这是struts-xml配置文件:

     <action name="LoginAction" class="sedion.xq.action.LoginAction">

     <interceptor-ref name="token"></interceptor-ref>

     <interceptor-ref name="defaultStack"></interceptor-ref>

     <result>

     /dakjfhkah.jsp

     </result>                       

     <result name="invalid.token">/index.jsp</result>

     </action>

     or

           <action name="LoginAction" class="sedion.xq.action.LoginAction">

         <interceptor-ref name="tokenSession"></interceptor-ref>

         <interceptor-ref name="defaultStack"></interceptor-ref>

         <result>

         /dakjfhkah.jsp

         </result>

         </action>

【不懂可以发帖 版主一直在。】