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.
分享到:
相关推荐
the difference between the 2 struts1
Difference between HBase and RDBMS
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
state 50 differences between marketing and sales
What's the Difference between Pneumatic, Hydraulic, and Electrical Actuators.docx
ModelMaker Structured Difference Viewer v1.5.0.173
FX2 and FX2LP 系列的区别 cy7c68013A开发套餐
Data collection at ultra high-frequency on ... Overall the difference in the coefficients is bigger between the dirty series and the clean series than among series filtered with different algorithms.
新人教版Unit 1 Making a difference[精选].doc
项目三 日光灯照明电路的制作 任务 1. 正弦交流电的基本概念 2. 正弦量的相量表示法 3.电路元件与定律的相量模型 4. RLC串并联电路的分析 5. 谐振电路的分析 3. 同频率正弦量的相位差 (phase difference)。 设 u(t)=...
Difference Between VMWare ESX and VMWare ESXi
Type used to represent the difference between two pointers.
2020版新教材高中英语 单元素养评价(二)Unit 2 Making a difference 外研版3.doc
Time Dependent Problems and Difference Methods addresses these various industrial considerations in a pragmatic and detailed manner, giving special attention to time dependent problems in its ...
What's the difference between TAF and FCF
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....
等效采样示波器与实时采样示波器区别
java and C++ difference