What is the difference between Struts 1.x and Struts 2.x ?


Struts 1.x : 
  • Struts 1  receives an input by creating an ActionForm object.
  • Like the Action classes, all ActionForms class must extend a ActionForm base class. 
  • Other JavaBeans classes cannot be used as ActionForms, while developers create redundant classes to receive the input. 
  • DynaBeans is the best alternative to create the conventional ActionForm classes.
  • Struts 1 uses manual validation that is done via a validate() method on the ActionForm, or by using an extension to the Commons Validator. 
  • Classes can have different validation contexts for the same class, while chaining to validations on sub-objects is not allowed.
Struts 2.x : 
  • Struts 2 requires Action properties as input properties that eliminates the need of a second input object. 
  • These Input properties may be rich object types, since they may have their own properties. 
  • Developer can access the Action properties from the Web Page using the taglibs. Struts 2 also supports the ActionForm pattern, POJO form objects and POJO Actions as well.
  • Struts 2 allows manual validation that is done by using the validate method and the XWork Validation Framework.
  • The Xwork Validation Framework allows chaining of validations into sub-properties using the validations defined for the properties class type and the validation context.

Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email