heting

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            40 隨筆 :: 9 文章 :: 45 評(píng)論 :: 0 Trackbacks

          struts.xml中配置攔截器和重復(fù)提交以后跳轉(zhuǎn)的頁面

          <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 賀挺 閱讀(2809) 評(píng)論(6)  編輯  收藏

          評(píng)論

          # re: struts2+freemarker中防止表單的重復(fù)提交token[未登錄] 2011-03-02 16:02 zz
          你好。。我在freemarker的頁面調(diào)用了<@s.token> 報(bào)錯(cuò);
          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)
          請(qǐng)問是怎么回事?  回復(fù)  更多評(píng)論
            

          # re: struts2+freemarker中防止表單的重復(fù)提交token 2012-06-05 22:28 licheng
          @zz
          我的也是  回復(fù)  更多評(píng)論
            

          # re: struts2+freemarker中防止表單的重復(fù)提交token 2015-04-23 09:15 51互聯(lián)云-濟(jì)南程序猿

          @licheng
          @zz

          必須在<from></from> 表單之中添加 <@s.token />

          注意 <@s.token /> 關(guān)閉標(biāo)簽。

          struts.xml文件 配置tokenSession 攔截器
            回復(fù)  更多評(píng)論
            

          # re: struts2+freemarker中防止表單的重復(fù)提交token 2015-12-29 16:06
          套頭  回復(fù)  更多評(píng)論
            

          # re: struts2+freemarker中防止表單的重復(fù)提交token 2015-12-29 16:07
          沒關(guān)系,大家好,什么都沒有  回復(fù)  更多評(píng)論
            

          # re: struts2+freemarker中防止表單的重復(fù)提交token 2015-12-29 16:08
          @51互聯(lián)云-濟(jì)南程序猿
          你什么都不懂,瞎說  回復(fù)  更多評(píng)論
            


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 大同市| 新建县| 伊春市| 凤城市| 大田县| 盱眙县| 永新县| 皮山县| 句容市| 化州市| 岚皋县| 新泰市| 雅安市| 两当县| 沽源县| 营山县| 北流市| 中山市| 桂平市| 云梦县| 汉川市| 咸丰县| 桂阳县| 开封市| 蓬莱市| 辛集市| 石泉县| 扬中市| 东乡族自治县| 新巴尔虎左旗| 庐江县| 彩票| 称多县| 庄河市| 玉门市| 鹤壁市| 长寿区| 永福县| 唐海县| 赣榆县| 襄樊市|