Struts2中Action必须实现execute方法吗
来源:互联网 发布:java读取txt文件第二行 编辑:程序博客网 时间:2024/06/05 18:45
好长时间没有写博客了,今天遇到了一个问题,顺利的解决了,分享出来。
struts2中action中是否需要实现execute方法呢?
其实分两种情况:
1)如果你的Action类是继承自ActionSupport或是BaseAction的话,确切的说是重写了execute方法,ActionSupport里的默认实现就是返回"success"视图。因此,你可以不实现execute方法,只要你的struts.xml里有"success"对应的result即可。
这段代码中就是通过action的配置文件来控制跳转页面。在action的类中没有execute()方法重写。
不过,大部分情况下都是继承ActionSupport的(比如输入验证、文件上传等功能就要求必须继承)。还有,不管你写没写execute方法,还是可以用<action>标签的method属性指定其他方法的。原文
0 0
- Struts2中Action必须实现execute方法吗
- Struts2中Action必须实现execute方法吗
- struts2框架中Action必须实现execute方法?和Struts参数传递
- Struts2之------Action类中的get,set方法和execute方法的使用规范和使用流程(规范是没有理由的,必须遵守!!!)
- struts2 action中的execute方法只执行一次
- Action的execute()方法
- 在Struts2中,我的Action中不管有execute方法,还有edit() list() add()等方法,我如果只想让拦截器拦截edit方法和add方法,请问可以吗?如果可以请告诉我一下怎么
- 在Struts2.x中使用非execute方法的实现及调用
- Struts2 Action的三种实现方法
- com.bjsxt.struts2.front.action.IndexAction1.execute()
- 在struts2中默认执行的execute方法
- Struts2中Action接收参数的方法
- Struts2中Action接收参数的方法
- Struts2中action接受参数方法
- 改变struts2中action后缀的方法
- Struts2中Action接收参数的方法
- struts2的action中方法重复执行
- Struts2中Action接收参数的方法
- usb摄像头拍照(javacv--1)
- 【机器学习基础】支持向量回归
- SKYNET环境配置
- thinkphp核心源码注释|Cache.class.php
- sql索引
- Struts2中Action必须实现execute方法吗
- Android使用ViewPager实现左右循环滑动及轮播效果
- 7. 常见的简单负载均衡算法以及Java实现
- 一张图看懂JavaScript中数组的迭代方法
- linux编程-信号讲解
- Eclipse的技巧(快捷键等)
- 解决本地HOSTS文件不读取问题
- mac下source tree配置外部比较工具beyond compare
- document.body 和 document.documentElement 的区别