Struts 2 is the advanced version of Struts framework. This new framework is re-invented the MVC framework by integrating to another framework known as Webwork. There are handful of new features introduced in the Struts 2 release. When the Struts 1.0 was released, Struts is considered as the most popular web frameworks used by the Java developers and it simplifies the use of Model – View – Controller (MVC) pattern by introducing the Action classes and Action forms.
Over the years, improvement of web technologies like AJAX, JSF, etc. has made more Java developers felt Struts is more complex framework and started switching to other frameworks. This leads to developing the Struts 2 framework. The primary theme for the Struts 2 framework is the simplifying the web development.
Struts 2 New Features
- POJO Based forms and actions
- Improved Tags and Customization
- AJAX Functionality
- Easy Integration
- Minimal Configurations
- Integrate View Technologies
- Theme and Templates
POJO Based forms and actions
Since the inception of Struts framework, we used actions and action forms for receiving the inputs. The problem here is these classes are extending the Struts API and not the plain POJOs. Struts 2 has moved away from this concept and used the plain POJOs to receive inputs from the form fields.
Improved Tags and Customization
Struts 2 has improved the existing form tags to reduce the amount of code written by the developers. Also it is very easy to extend the tags and write our own functionality. Tag markups in Struts2 can be changed using Freemarker templates. This does not require any advanced knowledge like JSP or java . Basic knowledge on UI frameworks are sufficient to modify the tags.
With the introduction of Web 2.0 technologies, AJAX is the integral part of any web frameworks. It becomes necessary to support AJAX with in the Struts 2 framework.
One of the greatest strength of a framework is to easily intergrate with any other frameworks. Every framework must provide the abstraction layer for integrating with other frameworks. Spring is the leading framework who supports the maximum possible integrations. Struts 2 provides the more number of integration lim Spring, Sitemesh, etc.
There is minimal configuration required for the Struts 2 application. Most of the settings will take the default values unless if there is any deviation from the default settings.
Integrate View Technologies
You can work with different view technologies with easy integration to Struts 2. It supports various view technologies like XSLT, JSP, Freemarker, velocity, etc.).
Theme and Templates
Struts 2 provides 3 types of themes: xhtml, simple and css_xhtml. The xhtml is default theme of struts 2. Themes and templates can be used for common look and feel across the applications. It would be easy for the developers to change the over all look of a website by changing the theme files.