I would like to know the difference between Struts 1.x and Struts 2.x
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The major difference is that in Struts1.x the request directly goes to the servlet, whereas in Struts2.x the 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 of http://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 and struts2.x action can still access the original request and response.
3. Getting Input
4. Testability
5. Expression Languages
6. Type Conversion
7. Validation
Server side validation are made in action classes in Struts2.x, a much simpler way.