The major difference is that in Struts1.x the request directly goes to the servlet, whereas in Struts2.xthe request and response traval though the stack of interceptor or filter. The regular logic can be placed in Filter classes and developer can concentrate on the Business Logic. Besides this there is also differences in directory structure.
It is better to know the differences between Struts1.x and Struts2.x topic wise. Here's a cite ofhttp://www.geekinterview.com/question_details/64360:
1. Action Classes
In Struts 1.x the action classes should extend Action (or DispatchAction) class and the execute method have number of parameter and a ActionForward return type , but In struts 2.x the action class can also be simple pojo having execute method returning only a string without any input parameter.
2. Servlet Dependancy
Container does not treat Struts2.x, unlike that of Struts1.x, Actions as a request / response couple andstruts2.x action can still access the original request and response.
3. Getting Input
- In Struts1.x form beans are used to define properties, getters & setters, in struts2.x getters/setters are defined in action classes itself.
-
Struts1.x form beans class must extend ActionForm or ValidatorForm, but Struts2.x beans can also be POJO.
4. Testability
- In Struts1.x execute() method exposes the servlet API for testing.
-
Struts2.x Dependancy Injection be used to simplify the testing process.
5. Expression Languages
-
Struts1.x JSTL as its expression language, where as Struts2.x uses OGNL(Object Graphic Notation Language) as its expression language which is very strong than JSTL.
-
Struts2.x can also use JSTL.
6. Type Conversion
- In Struts1.x properties are almost in String form, Convertors are per class which are not configurable.
-
Struts 2.x uses OGNL for type conversion
7. Validation
Server side validation are made in action classes in Struts2.x, a much simpler way.
分享到:
相关推荐
A computer's architecture is its abstract model and is the programmer's view in terms of instructions, addressing modes and registers. A computer's organization expresses the realization of the ...
Difference Be...Pronunciation_马生虎.caj
1. 数据模型: - RDBMS采用表格形式存储数据,强调行与列的关系,支持复杂的查询语言(如SQL),适用于高度结构化的数据。 - HBase则是列族(Column Family)存储,数据以稀疏、多维的键值对形式存在,更适合非...
1. 目标与期限:市场营销关注长期的竞争优势和未来市场趋势,旨在解决问题并创造需求;而销售主要关注当前的业绩和即时的市场需求。 2. 消费者视角:市场营销关注消费者的需求和心理,尝试影响他们的认知和决策;...
1. 硬件差异 - 晶振规格的变更:FX2LP可能需要与FX2不同的晶振,设计人员在迁移过程中需要注意到这一点。 - 最小复位时间:FX2LP对最小复位时间有新的要求,这可能需要在硬件设计中进行修改。 - VCCRamp-up时间:...
1. **可视化对比**:ModelMaker Structured Difference Viewer 提供了直观的图形界面,让用户能够一目了然地看到两个模型之间的不同之处。这包括实体、属性、关系以及它们之间的关联。 2. **详尽的差异报告**:工具...
1. 空间离散化:将区间[0, L]分为N个等间距点,x_i = iΔx,Δx = L/(N-1),i=0,1,...,N-1。 2. 时间离散化:选取时间步长Δt,U_i^n 表示在时间nΔt时,位置x_i处的函数值。 3. 差分近似:Ut ≈ (U_i^{n+1} - U_i^n...
Chapter 1—Origins, Context and Popularity of Go...............................................................1 1.1 Origins and evolution................................................................
1.1 Origins and evolution................................................................................................1 1.2 Main characteristics, context and reasons for developing a new language....
【新人教版Unit 1 Making a difference】是一个教学材料,主要围绕着科学界的重要人物以及一个关于成为天才的讨论话题展开。在这个单元中,学生将接触到一些著名的科学家,了解他们的成就,并探讨如果普通人能通过...
java and C++ difference
1. **信令方式与控制机制**: - **PLMN**中,移动交换中心(MSC)采用特定的信令协议(如7号信令系统)进行通信控制。MSC只接收特定类型的信令消息,例如SAM、SAO、CCL和SCB等。 - **PSTN**则使用更广泛的信令系统...
在压缩包"develop in IE and Firefox"中,可能包含的是针对这两种浏览器开发的示例代码、测试用例或解决兼容性问题的策略,可以帮助开发者更好地理解并处理IE和Firefox之间的差异。通过深入研究这些文件,开发者可以...
分享一个大牛的人工智能教程。零基础!通俗易懂!风趣幽默!希望你也加入到人工智能的队伍中来!...Selenium webdriver provides two methods for closing a ... In this post, we will study the difference between
igs观测数据文件处理,差分计算(c1-l1 c1-p1 c1-p2)
2 Relationship between processes..............................................................................................- 14 - 2.1 Configuration Management..........................................
the Difference Between Them) .................................................................................................. 14 Surface Objects and The Window .........................................