struts2的actionsupport中的execute()方法理解
来源:互联网 发布:mac能玩什么单机游戏 编辑:程序博客网 时间:2024/05/22 14:18
之前用struts2的时候,一直看到execute这个方法,一直没有放在心上。今天突然好奇心发作,想看看他是用来干嘛的。
原来当你的类继承了ActionSupport类并且<action>没有method时,它默认调用execute方法,并且execute方法的返回值是success.
写个例子吧!不然太抽象
这是我继承了ActionSupport的类,然后我重写了execute方法。
public class HelloWorldAction extends ActionSupport{@Overridepublic String execute() throws Exception {System.out.println("execute@@@@@@@@@@@@@@@@@@@@@@");return super.execute();}}
这是我在struts.xml文件中相应的配置,注意:这个action没有method方法,所以他调用了execute方法。
<action name="helloworld" class="cn.csdn.action.HelloWorldAction"><result name="success">/WEB-INF/page/hello.jsp</result></action>
当我启动项目的时候,控制台输出了
execute@@@@@@@@@@@@@@@@@@
当你没有继承ActionSupport类时,你可以自己写一个execute方法。同样也会调用。
0 0
- struts2的actionsupport中的execute()方法理解
- struts2的ActionSupport里面有execute
- struts2 ActionSupport中的validate方法
- struts2中的ActionSupport
- struts2中的actionSupport
- 关于Struts2中的execute方法
- 用Struts2中的ActionSupport中的validate方法进行表单验证
- 用Struts2中的ActionSupport中的validate方法进行表单验证
- struts2的ActionSupport
- Struts2中的Action和ActionSupport
- struts2中的Action接口和Actionsupport接口的作用
- struts2中的execute()方法没有执行
- struts2 中 Actionsupport 的作用
- struts2 中 Actionsupport 的作用
- Struts2 继承ActionSupport的用处
- struts2 中 Actionsupport 的作用
- struts2 中 Actionsupport 的作用
- Struts2常用的类ActionSupport
- Spring Security3 - MVC 整合教程 (初识Spring Security3)
- 正则表达式30分钟入门教程
- java annotation类型
- web前端之锋利的jQuery二:jQuery选择器
- Linux查看物理CPU个数、核数、逻辑CPU个数
- struts2的actionsupport中的execute()方法理解
- WebStorm 常用技巧
- sh提示“no such file or directory”解决办法
- 树莓派之Camkit学习
- Oracle DBMS_RANDOM包生成随机数
- MyBatis中关于resultType和resultMap的区别
- 自学--数据库笔记--第七篇--SQL sever2008更新数据
- Oracle中debug权限的开通
- 分享一个垃圾计时器(倒计时)