李李的技術博客

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            13 隨筆 :: 0 文章 :: 61 評論 :: 0 Trackbacks
          <2005年12月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          常用鏈接

          留言簿(4)

          隨筆分類

          隨筆檔案

          文章分類

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          一個例子,原來的

          <interceptor-ref name="validation"/>
          <interceptor-ref name="workflow"/>

          可改寫為
          <interceptor-ref name="validation">
              <param name="excludeMethods">input,back,cancel</param>
          </interceptor-ref>
          <interceptor-ref name="workflow">
              <param name="excludeMethods">input,back,cancel</param>
          </interceptor-ref>

          那么,對于簡單的需驗證頁面,不需要再因為避免不必要的校驗而分兩個action。

          只有com.opensymphony.xwork.validator.ValidationInterceptor, com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor 定義并實現了這個excludeMethods,實現的也還是比較粗糙的,我們在做類似實現的時候可以參考一下,有必要也可以改進,擴展一下,例如增加includeMethods
              public void setExcludeMethods(String excludeMethods) {
                  
          this.excludeMethods = TextParseUtil.commaDelimitedStringToSet(excludeMethods);
              }

              
          public String intercept(ActionInvocation invocation) throws Exception {
                  
          if (excludeMethods.contains(invocation.getProxy().getMethod())) {
                      log.debug(
          "Skipping workflow. Method found in exclude list.");
                      
          return invocation.invoke();
                  }
                  
              }
          posted on 2005-12-03 22:29 李李 閱讀(1528) 評論(2)  編輯  收藏 所屬分類: 技術

          評論

          # re: Webwork2.2的一個改進,Interceptor增加excludeMethods方法 2005-12-04 00:17 scud(飛云小俠)
          太棒了!   回復  更多評論
            

          # re: Webwork2.2的一個改進,Interceptor增加excludeMethods方法 2005-12-04 00:36 scud(飛云小俠)
          引用了一下,多謝 :)

          http://www.jscud.com/srun/news/viewhtml/4_2005_12/164.htm
            回復  更多評論
            

          主站蜘蛛池模板: 辽宁省| 那坡县| 衡阳市| 从化市| 视频| 新郑市| 大兴区| 桐城市| 白朗县| 开化县| 昌宁县| 屯留县| 子洲县| 河东区| 唐山市| 星子县| 清丰县| 广汉市| 甘肃省| 都匀市| 宽城| 泾川县| 富民县| 亚东县| 中方县| 大关县| 安庆市| 抚宁县| 富蕴县| 济南市| 临邑县| 盘锦市| 天等县| 香河县| 嵩明县| 桃园市| 芦溪县| 商水县| 高清| 阜平县| 禄丰县|