如何在一个Action类中包含多个业务方法

Step1. 在Action类中定义多个业务方法,
     这些方法的原型与execute相同
     Step2.在配置文件中使用通配符*
      <package namespace="/test">
       <action name="test2_*"
                     class="com...TestAction"
                     method="{1}">
          ....
        </action
        </package>
         -------------------------------------
         RequestURI: 
           /dang/test/test2_update.action
           a. 核心控制器分析url得到:
                 namespace="/test"
                 actionName="test2_update"
           b.  namespace="/test"--><package namespace="/test">
                通过namespace找到对应的<package>
            c.在<package> 中寻找与actionName
            匹配的<action>.
                test2_update
                     ----> <action name="test2_*">
             d. 将method替换为*对应的方法名:
                  test_update---> update---*
                                      ---->method="update"

猜你喜欢

转载自jacular.iteye.com/blog/1592538