heting

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  40 随笔 :: 9 文章 :: 45 评论 :: 0 Trackbacks

struts.xml中配置拦截器和重复提交以后跳转的页面

<action name="orderOk" class="foodShop"
   method
="orderOk">
     
<interceptor-ref name="token"/>        
     
<interceptor-ref name="defaultStack"/>   
  
<result name="invalid.token" type="freemarker">/WEB-INF/outlook/food_01/error.html</result>
   
<result type="freemarker">
    /WEB-INF/outlook/food_01/order_ok.html
   
</result>
  
</action>
在页面的表单中加入<@s.token>就可以了
posted on 2008-11-21 11:57 贺挺 阅读(2787) 评论(6)  编辑  收藏

评论

# re: struts2+freemarker中防止表单的重复提交token[未登录] 2011-03-02 16:02 zz
你好。。我在freemarker的页面调用了<@s.token> 报错;
java.lang.IllegalArgumentException: Error creating HttpSession due response is commited to client. You can use the CreateSessionInterceptor or create the HttpSession from your action before the result is rendered to the client: Cannot create a session after the response has been committed
at org.apache.struts2.util.TokenHelper.setToken(TokenHelper.java:77)
请问是怎么回事?  回复  更多评论
  

# re: struts2+freemarker中防止表单的重复提交token 2012-06-05 22:28 licheng
@zz
我的也是  回复  更多评论
  

# re: struts2+freemarker中防止表单的重复提交token 2015-04-23 09:15 51互联云-济南程序猿

@licheng
@zz

必须在<from></from> 表单之中添加 <@s.token />

注意 <@s.token /> 关闭标签。

struts.xml文件 配置tokenSession 拦截器
  回复  更多评论
  

# re: struts2+freemarker中防止表单的重复提交token 2015-12-29 16:06
套头  回复  更多评论
  

# re: struts2+freemarker中防止表单的重复提交token 2015-12-29 16:07
没关系,大家好,什么都没有  回复  更多评论
  

# re: struts2+freemarker中防止表单的重复提交token 2015-12-29 16:08
@51互联云-济南程序猿
你什么都不懂,瞎说  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: