Difference Between Struts1.x and Struts 2.x

Features
Struts 1.x
Struts 2.x
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 interfaces. An Struts 2 Action mayimplement anActioninterface, 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 isnotrequired. Any POJO object with aexecutesignature can be used as an Struts 2 Action object.
Binding Values into views To access different objects , struts 1 uses the standard jsp implict objects It use valuestack to hold the values and to reterive the value from value stack it use OGNL (Object Graph Navigational Language)
Servlet Dependency In action execute method , it has HttpServletRequest and HttpServletResponse Object, both comes from servlet API Not needed in struts 2 execute method
Testablity A major hurdle to testing Struts 1 Actions is that theexecutemethod 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.
No Action Form 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 create redundant classes to capture input. Struts 2 uses Action properties as input properties, eliminating the need for a second input object
Control Of Action Execution Struts 1 supports separate Request Processors (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.

struts.xml-format files from a bootstrap struts.xml file

Login.jsp

LoginAction.jsp

Struts.xml

UI in Struts 2

Designing UI in Struts 2
  • The form Tag
  • The textfield tag
  • The TextArea tag
  • The password tag
  • The Checkbox Tag
  • The Radio Tag
  • The Hidden Tag
  • The Combo box
  • The submit tag
  • The datetimepicker tag