| Feature | Struts 1 | Struts 2 |
|---|---|---|
| Action classes | Struts 1 requires(需要) Action classes to extend an abstract base class. Acommon(通用的) problem in Struts 1 is programming to abstract classesinstead of(代替) interfaces. | An Struts 2 Action may implement an Action interface, along with other interfaces to enable optional and custom services. Struts 2 provides a base ActionSupport class to implement commonly used interfaces. Albeit, the Action interface is not required. Any POJO object with a execute signature can be used as an Struts 2 Action object. |
| Threading Model | Struts 1 Actions are singletons(单一的) and must be thread-safe since there will only be one instance of a class to handle all requests for that Action. The singleton strategy places restrictions on what can be done with Struts 1 Actions and requires extra care to develop. Action resources must be thread-safe or synchronized. | Struts 2 Action objects are instantiated for each request, so there are no thread-safety issues. (In practice, servlet containersgenerate(产生) many throw-away objectsper(每一) request, and one more object does not impose a performance penalty or impact garbage collection.) |
| Servlet Dependency | Struts 1 Actions have dependencies(依赖) on the servlet API since the HttpServletRequest and HttpServletResponse is passed to theexecute method when an Action is invoked. | Struts 2 Actions are not coupled(耦合的) to a container. Most often the servlet contexts arerepresented(代表) as simple Maps, allowing Actions to betested(检测) in isolation(隔离). Struts 2 Actions can still access theoriginal(原有的) request and response, if required. However, other architectural elements reduce or eliminate the need to access the HttpServetRequest or HttpServletResponse directly. |
| Testability | A major hurdle(主要障碍) to testing Struts 1 Actions is that theexecute method exposes(自曝) the Servlet API.A third-party extension(三方软件), Struts TestCase, offers a set of mock object for Struts 1. | Struts 2 Actions can be tested by instantiating the Action, setting properties, and invoking methods. Dependency Injection support also makes testing simpler. |
| Harvesting Input | Struts 1 uses an ActionForm object to capture(捕获) input. Like Actions, all ActionForms must extend a base class. Since other JavaBeans cannot be used as ActionForms, developers often createredundant(多余的) classes to capture input. DynaBeans can used as analternative(替代) to creating conventional(传统的) ActionForm classes, but, here too, developers may be redescribing existing JavaBeans. | Struts 2 uses Action properties as input properties, eliminating(排除) the need for a second input object. Input properties may be rich object types which may have their own properties. The Action properties can be accessed from the web pagevia(通过) the taglibs. Struts 2 also supports(支持) the ActionForm pattern, as well as POJO form objects and POJO Actions. Rich object types, including business ordomain(定义域) objects, can be used as input/output objects. The ModelDriven feature simplifies taglb references to POJO input objects. |
| Expression Language | Struts 1 integrates(一体化) with JSTL, so it uses the JSTL EL. The EL has basic object graph traversal, butrelatively(相对) weak(较弱) collection and indexed property support. | Struts 2 can use JSTL, but the framework also supports a morepowerful(强大的) and flexible(灵活的) expression(表达式) language called "Object Graph Notation Language" (OGNL). |
| Binding values into views | Struts 1 uses the standard(标准的) JSPmechanism(机制) for binding objects into the page context for access. | Struts 2 uses a "ValueStack" technology(技术) so that the taglibs can access values withoutcoupling(耦合) your view to the object type it is rendering. The ValueStack strategy allowsreuse(重用) of views across a range of types which may have the same property name but different property types. |
| Type Conversion | Struts 1 ActionForm properties are usually all Strings. Struts 1 uses Commons-Beanutils for type conversion. Converters are per-class, and not configurable per instance. | Struts 2 uses OGNL for type conversion. The framework includes converters for basic and common object types andprimitives(基本实体). |
| Validation | Struts 1 supports manual(手动) validation(验证) via avalidate method on the ActionForm, or through an extension(扩展) to the Commons Validator. Classes can have different validation contexts for the same class, but cannot chain to validations on sub-objects. | Struts 2 supports manual validation via the validate method and the XWork Validation framework. The Xwork Validation Framework supports chaining validation into sub-properties using the validations defined for the properties class type and the validation context. |
| Control Of Action Execution | Struts 1 supports separate(单独的) RequestProcessors(处理器) (lifecycles) for each module(模块), but all the Actions in the module must share the same lifecycle. | Struts 2 supports creating different lifecycles on a per Action basis via Interceptor Stacks.Custom(自定义的) stacks can be created and used with different Actions, as needed. |
相关推荐
【详细图文】使用MobaXterm的SSH功能远程连接服务器,并创建pytorch环境,使用yolov8训练数据集
使用MobaXterm的SSH功能远程连接服务器,并创建pytorch环境,使用yolov8训练数据集,以及MobaXterm使用介绍和linux基础命令介绍。
diff of struts2 and struts1
在Action 实现类方面的对比:Struts 1 要求Action 类继承一个抽象基类;Struts 1 的一个具体问题是使用抽象类编程而不是接口。Struts 2 Action 类可以实现一个Action 接口,也可以实现其他接口,使可选和定制的服务成为可能。Struts 2 提供一ActionSupport 基类去实现常用的接口。即使 Action 接口不是必须实现的,只有一个包含exe...
【同花顺公式编辑教程】第4章 功能函数
本章节主要给出大部分能够运行且常用的同花顺指标编辑器提供的函数。其中,计算类函数不作演示,绘图类函数提供示例及示例运行结果。
Struts2_与Struts1比较and基本配置
<br />Struts2有以下优点:在软件设计上struts2没有像struts1那样跟Servlet API和struts API有着紧密的耦合,struts2应用可以不依赖于Servlet API和Struts API,Struts2的这种设计属于无侵入式设计。Struts2提供了拦截器,利用拦截器可以进行AOP编程,实现如权限拦截的功能。Struts2提供了类型转换器,我们可以把特殊的请求参数转换成需要的类型。Struts1中,如果要实现同样的功能,就必须向Struts1的底层实现BeanUtil注
从Oracle迁移数据到Hadoop
目标:把Oracle 下的数据文件迁移到 Hadoop , 数据表都是上亿条,每个数据表的空间都超过100G。 关键是建立数据文件是UTF8格式,这样数据中的汉字在Hadoop 里显示才正常。 平台:CentOS 6.10 工具:Python 2.7 cx_Oracle 库 Oracle10.2.0.4.0 Hadoop 2.7.2-transwarp-5.2.1 1. 查看表...
世界职业院校技能大赛财经赛道项目参考逐字稿五
世界职业院校技能大赛财经赛道项目参考逐字稿五
sturts1 and struts2
Struts作为MVC 2的Web框架,自推出以来不断受到开发者的追捧,得到广泛的应用。作为最成功的Web框架,Struts自然拥有众多的优点:MVC 2模型的使用、功能齐全的标签库(Tag Library)、开放源代码。 但是,正所谓“没有最好,只有更好”,Struts1.x自身也有不少的缺点:需要编写的代码过多,容易引起“类爆炸”、单元测试困难。这些缺点随着Web的发展越来越明显。这
使用Simulink进行基于IIR滤波器的设计与稳定性分析仿真
IIR滤波器的稳定性与其系统函数的极点位置密切相关。如果所有极点都位于Z平面的单位圆内,则该滤波器是稳定的;否则,滤波器将是不稳定的。在设计IIR滤波器时,确保其稳定性对于避免输出信号发散至关重要。明确你的系统需求,比如输入信号类型(如正弦波)、采样率、IIR滤波器的设计参数(如滤波器类型、阶数、截止频率等)。假设我们需要设计一个低通IIR滤波器,用来去除高于500Hz的所有频率成分,保留低于500Hz的信号成分。采样率为8kHz。
Comparing Struts1 and Struts2
Feature Struts 1 Struts 2 Action classes Struts 1 requires Action classes to extend an abstract base class. A common problem in Struts 1 is programming to abstract classes instead of interface
YOLOv8 改进有效涨点专栏目录 | 含卷积、主干、注意力机制、Neck、检测头、损失函数、二次创新C2PSA/C3k2等各种网络结构改进
YOLOv8在目标检测领域的地位与优势模型改进的意义与价值本专栏的特色与创新点读者学习路径建议关键改进点回顾不同场景的模型选型建议开源社区资源汇总持续学习路径指南YOLOv8在目标检测领域的地位与优势模型改进的意义与价值本专栏的特色与创新点读者学习路径建议关键改进点回顾不同场景的模型选型建议开源社区资源汇总持续学习路径指南。
2025华为杯第二十二届中国研究生数学建模竞赛A题:通用神经网络处理器下的核内调度问题 - 完整解题分析+完整MATLAB源码!
🎓 本文收录于 《滚雪球学数学建模》专栏,本专栏专注于从零基础出发,带你循序渐进掌握数学建模的核心方法与思维路径。通过“滚雪球式”学习法,从最简单的生活化案例到经典建模工具,再到省赛、国赛真题实战演练,逐步积累知识与技能,帮助你搭建完整的建模体系。无论你是刚接触建模的新生,还是希望提升科研与竞赛能力的学者与工程师,本专栏都将为你提供一条清晰、高效、可实操的建模成长路线,助力你快速进阶,突破难点,迈向数学建模竞赛与实际应用的更高峰 🚀!
difference between struts1 and struts2
struts2 struts1 difference
YOLOv13零基础手把手教程:在 YOLOv13 中集成 SFSConv,YOLOv13让目标检测更上一层楼
YOLOv13本教程详细介绍了如何在YOLOv13中集成SFSConv模块以提升目标检测性能。YOLOv13 SFSConv创新性地结合了分数伽柏滤波和分数傅里叶变换,通过空间处理单元(SPU)和频率处理单元(FPU)解耦处理特征。实验表明,该模块可使准确率提升5.21%,mAP提高11.45%。教程从原理分析到代码实现,系统讲解了SFSConv的数学基础、模块设计,并提供了在YOLOv13中集成该模块的详细步骤,包括配置文件修改、核心代码实现等。
Comparing Struts 1 and 2
Feature Struts 1 Struts 2 Action classes Struts 1 requires Action classes to extend an abstract base class. A common problem in Struts 1 is programming to abstract classes instead of i
精雕软件(JDpaint) 5.5 绿色版
精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版
TMS_WebGMaps_1.9.8.0_Full_Source
TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder
difference between struts1.x and Struts2.x
<br />http://www.geekinterview.com/question_details/64360<br /> eature Struts 1 Struts 2 Action classes Struts1 extends the abstract base class by its action class. The problem with struts1 is that it uses the abstract classes rather than interfaces. W
Data-Structures-and-Algorithm-Analysis-in-Java.pdf
作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...
struts1 and struts2区别()
1) 在Action实现类方面的对比:Struts 1要求Action类继承一个抽象基类;Struts 1的一个具体问题是使用抽象类编程而不是接口。Struts 2 Action类可以实现一个Action接口,也可以实现其他接口,使可选和定制的服务成为可能。Struts 2提供一个ActionSupport基类去实现常用的接口。即使Action接口不是必须实现的,只有一个包含execute方法的P
Camera2Demo
在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作
转:Comparing Struts 1 and 2
Feature Struts 1 Struts 2 Action classes Struts 1 requires Action classes to extend an abstract base class. A common problem in Struts 1 is programming to abstract classes instead of ...
比较Struts1.x和struts2.0 and struts2.1
<br />Struts实现了MVC模式,结构清晰,使开发者能过关注业务逻辑的实现.在应用Struts框架做项目开发的过程中我们更能体会到这种模式的优越性。下面就简单的谈谈不同Struts版本之间的差异:<br />首先,从web.xml配置文件中所配置的前端控制器谈起.<br /> Struts1.x的前端控制器是一个Servlet;<br /> Struts2的前端控制器是一个filter,Struts2.0中的名字是Filterdispatcher;Struts2.1中的名字是StrutsPrep
3385



被折叠的 条评论
为什么被折叠?



