现在的位置: 首页 > 综合 > 正文

struts1.x 动态方法调用

2013年11月19日 ⁄ 综合 ⁄ 共 565字 ⁄ 字号 评论关闭

1: 自定义的 Action 必须继承 DispatchAction 而不能继承  Action

public class UserAction extends DispatchAction

 

2:  Action 中不能有 execute(......)  方法 , 否则将始终调用该方法:

 

3: struts-config 配置文件中应该增加如下配置:

 

<action 。。。。parameter="method" > </action>

 

 

======================================

<action path="/user"
   type="org.springframework.web.struts.DelegatingActionProxy" name="user"
   parameter="method" scope="request">
   <forward name="add_success" path="list.jsp"></forward>
   <forward name="list" path="list.jsp"></forward>
</action>

 

=======================================

 

4: 通过 path.do?metho=xxx 的形式调用Action中的方法

 

 

 

 

 

 

 

 

抱歉!评论已关闭.