Struts2

Struts tutorial for beginners and professionals with examples in eclipse on Basics, Architecture, Configuration, Actions, Interceptors, Results, Result Types, Validations, Localization, Type Conversion, Tag Library, Exception Handling, Annotations and more.

Struts framework:

Struts is an elegant, extensible, open source framework for developing java web application. It is used to develop Model-View-Controller (MVC) architecture based web applications.

Struts 2 was originally known as webwork 2. Later on webwork and struts combined to produce a new version of struts i.e. struts 2 framework is the combination of webwork and struts.

Struts 2 = webwork + struts 1.

Struts 2 features.

1. POJO forms:

No need of Action forms in Struts 2. Any POJO class can be used to receive the form input.

2. POJO Actions:

No need of Action class in Struts 2. Any POJO class can be used as Action class.

3. Enhanced Tag Support:

Struts 2 provide no. of various tags to ease the development process.

4. Template Support:

Struts 2 provide the template support for generating common look views.

5. Easy Integration support:

Struts 2 applications can be easily integrate with other frameworks like spring, hibernate etc.

6. AJAX support:

Struts 2 provides the ajax support with ajax tags.

7. Enhanced Results support:

More special results can be get by using JasperReports, JFreeChart etc.

Difference between struts 1 and struts 2.

                 Struts 1               Struts 2
  1. Struts 1 Action classes must extends an abstract base class.
  2. Struts 1 Actions are thread safe because they are singletons.
  3. Struts 1 Actions are depends on the servlet API because the HttpServletRequest and HttpServletResponse have to be passed in the execute method.
  4. Struts 1 use the ActionForm’s object to receive the form input.
  5. Struts 1 use the JSTL expression language.
  6. Struts 1 uses the standard JSP mechanism for binding objects into the page context.
  7. Struts 1 provides less flexible type conversion.
  8. Struts 1 uses manual validation by validate method on the ActionForm.
  1. Struts 2 Action classes not have to extends any abstract class. They may implement an Action interface.
  2. Struts 2 Actions are not thread safe.
  3. Struts 2 Actions are not depend on the servlet API.
  4. Struts 2 eliminate the need of ActionForm.
  5. Struts 2 use the “Object Graph Notation Language” (OGNL) expression language.
  6. Struts 2 uses the ValueStack technology for binding values into views.
  7. Struts 2 provides more flexible type conversion.
  8. Struts 2 allows manual validation by using the validate method. It also the XWork Validation framework.

 

Struts 2 Basic tutorial:

Struts 2 UI tags tutorial:

Struts 2 control tags tutorial:

Struts 2 data tags tutorial:

Struts 2 integration tutorial:

Struts 2 interview questions:

 

Please Share