云自無心水自閑

          天平山上白云泉,云自無心水自閑。何必奔沖山下去,更添波浪向人間!
          posts - 288, comments - 524, trackbacks - 0, articles - 6
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          struts2中的conventions插件

          Posted on 2009-08-24 14:25 云自無心水自閑 閱讀(578) 評論(0)  編輯  收藏 所屬分類: Java心得體會Struts2
          struts2中conventions plugin的url取名規(guī)則:
          假設有一個類:com.example.actions.HelloWorld,
          Struts2會自動搜索所有實現(xiàn)了com.opensymphony.xwork2.Action接口或者在struts.xml中<constant name="struts.convention.package.locators" value="actions"/> 指定的包下的類。
          現(xiàn)存HelloWorld只是一個POJO,但是他在actions包下,這樣Struts2就認可這是一個Action.
          那么URL會是什么呢?是hello-world,類似于:http://localhost:8080/<contextPath>/hello-world.action.
          如果你不喜歡這樣的自動分配的URL,那么可以在里面的方法使用@Action來改變
          @Action("/helloWorld")
          public void execute() throws Exception {
              return "success";
          }

          主站蜘蛛池模板: 泰来县| 曲松县| 崇州市| 丘北县| 根河市| 高唐县| 汝城县| 浦江县| 稷山县| 察隅县| 莱芜市| 保康县| 东乌珠穆沁旗| 泰顺县| 民乐县| 宣城市| 湘乡市| 宣武区| 宝清县| 德兴市| 繁昌县| 惠安县| 莱芜市| 大邑县| 彝良县| 元谋县| 广德县| 仪征市| 阿巴嘎旗| 策勒县| 彝良县| 南丰县| 满洲里市| 沙雅县| 枝江市| 阜城县| 龙川县| 绩溪县| 东兴市| 林甸县| 江北区|