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 賀挺 閱讀(2800) 評論(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互聯云-濟南程序猿
          你什么都不懂,瞎說  回復  更多評論
            


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 安丘市| 林口县| 资阳市| 石柱| 馆陶县| 玉树县| 车致| 准格尔旗| 安阳县| 寻乌县| 海口市| 曲靖市| 盈江县| 四川省| 宁德市| 江西省| 建平县| 孙吴县| 土默特右旗| 金华市| 桓台县| 涡阳县| 绥滨县| 都江堰市| 新绛县| 自贡市| 江城| 偃师市| 阿克陶县| 呼玛县| 名山县| 紫云| 定州市| 榆树市| 湖口县| 凤凰县| 阳江市| 修文县| 南雄市| 连州市| 建宁县|