Action的动态调用方法
来源:互联网 发布:大隅级两栖攻击舰 数据 编辑:程序博客网 时间:2024/05/01 22:55
Action执行的时候并不一定要执行execute方法,我们可以指定Action执行哪个方法:
1、 方法一(通过methed属性指定执行方法):
可以在配置文件中配置Action的时候用method=来指定执行哪个方法
<action name="userAdd" class="com.bjsxt.struts2.user.action.UserAction" method="add">
</action>
import com.opensymphony.xwork2.ActionSupport;
public class UserAction extends ActionSupport {
}
2、 动态方法调用DMI(推荐)
可以在url地址中动态指定action执行那个方法。Url地址如下:
http://localhost:8080/Struts2_0500_ActionMethod/user/user!add
方法:action + ! + 方法名
注:只要Action对象中有这个方法,并且返回类型为String就可以调用。
这样Struts.xml配置文件中不需要配置methed属性。代码如下:
<action name="user" class="com.bjsxt.struts2.user.action.UserAction">
</action>
Action类:
public class UserAction extends ActionSupport {
}
- Action的动态调用方法
- Action的动态调用方法
- Action的动态方法调用
- 动态调用action方法
- 动态调用action方法
- Action动态方法调用
- 动态的调用action里面的方法
- 使用Action 的动态方法调用
- struts2 中action的动态方法调用
- Struts2中Action的动态调用方法
- Struts2中Action的动态调用方法
- Struts2中Action的动态方法调用
- Struts2的动态调用Action方法和默认Action
- struts2动态方法调用,javascript动态修改表单的action
- action中的动态方法调用
- struts2 action动态方法调用
- Action中的动态方法调用
- Struts2在动态调用Action的方法时的错误
- mysql基础知识
- linux静态库的创建与使用
- I/O :文件流
- IE6、IE7:ul li a span 组合中 span{ float:right}浮动后日期内容往下行移动总结
- 二维数组中的查找问题
- Action的动态调用方法
- 函数指针做为参数的例子
- String,StringBuffer与StringBuilder的区别
- Android中ArrayList的使用注意事项以及效率的比较
- SVN 的使用
- 聚类算法和分类算法总结
- POJ 3668 Game of Lines
- 随机化算法
- android学习心得:error:Warning: Activity not started, its current task has been brought to the front