(3.1.4.2)struts1和struts2
来源:互联网 发布:linux 压缩文件夹 命令 编辑:程序博客网 时间:2024/06/10 10:37
从action类上分析:
1.Struts1要求Action类继承一个抽象基类。Struts1的一个普遍问题是使用抽象类编程而不是接口。
2. Struts 2 Action类可以实现一个Action接口,也可实现其他接口,使可选和定制的服务成为可能。Struts2提供一个ActionSupport基类去实现常用的接口。Action接口不是必须的,任何有execute标识的POJO对象都可以用作Struts2的Action对象。
从Servlet 依赖分析:
3. Struts1 Action 依赖于Servlet API ,因为当一个Action被调用时HttpServletRequest 和 HttpServletResponse 被传递给execute方法。
4. Struts 2 Action不依赖于容器,允许Action脱离容器单独被测试。如果需要,Struts2 Action仍然可以访问初始的request和response。但是,其他的元素减少或者消除了直接访问HttpServetRequest 和 HttpServletResponse的必要性。
从action线程模式分析:
5. Struts1 Action是单例模式并且必须是线程安全的,因为仅有Action的一个实例来处理所有的请求。单例策略限制了Struts1 Action能作的事,并且要在开发时特别小心。Action资源必须是线程安全的或同步的。
6. Struts2 Action对象为每一个请求产生一个实例,因此没有线程安全问题。(实际上,servlet容器给每个请求产生许多可丢弃的对象,并且不会导致性能和垃圾回收问题)
从view分析
- Struts1 整合了JSTL,Struts2可以使用JSTL,但是也支持OGNL
- (3.1.4.2)struts1和struts2
- Struts1和struts2的区别(转)
- struts1和struts2及数据库连接(小结)
- Struts1和Struts2区别
- struts1和struts2对比
- struts1和struts2比较
- struts1和struts2区别
- struts1和struts2区别
- Struts2 和Struts1对比
- struts1 和 struts2 区别
- Struts1和Struts2比较
- Struts1 和 Struts2
- 区别struts1和struts2
- struts1和struts2区别
- Struts1 和 Struts2 比较
- struts1和struts2比较
- struts1和struts2区别
- struts1和struts2区别
- Java 多线程实现的两种方式
- HDU5375 Gray code
- iOS项目开发实战——iOS网络编程获取网页Html源代码
- 带分区的UITableView的创建(省市区字典)
- 窗口与视图UIScreen and UIView
- (3.1.4.2)struts1和struts2
- HDU 5373 The shortest problem
- 修改Android studio 中svn版本
- android ButterKnife
- threading.Timer
- java微信开发发送消息
- 王家林亲授《DT大数据梦工厂》第84讲:Scala中List和ListBuffer设计实现思考
- HDU 5375 Gray code
- iOS 多线程使用