Struts

The core features of the struts 2 framework:
  1. Pluggable framework architecture that allows request life cycles to be customized for each action.
  2. Flexible validation framework that allows validation rules to be decoupled from action code.
  3. Hierarchical approach to internationalization that simplifies localizing applications.
  4. Integrated dependency injection engine that manages component life cycle and dependencies. (By default, the framework utilizes Spring for dependency injection.)
  5. Modular configuration files that use packages and namespaces to simplify managing large projects with hundreds of actions.
  6. Java 5 annotations that reduce configuration overhead. (Java 1.4 is the minimum platform.)
Struts 2 request Processing:
Each and every request made using struts 2 framework fallows the same request processing as below:
  1. Initially the web browser requests for request. (Ex: /index.acion or /myreport.pdf .. etc)
  2. The filter dispatcher looks at the request and determines the appropriate action.
  3. The interceptors automatically apply common functionality to the request, like work flow, validation, and file upload handling.
  4. The action method executes, usually storing and/or retrieving information from a database.
  5. The request renders the output to the browser, be it HTML, images, pdf, or something else.
The features added in struts2 over the struts1:
  1. Programming the abstract classes instead of interfaces is one of the design problem of struts1 framework that has been resolved in struts2.
  2. Most of the struts2 classes are based on interfaces and most of its core interfaces are HTTP independent.
  3. Unlike ActionForwards, Struts2 results provide flexibility to create multiple type of outputs.
  4. Actions in struts1 have dependencies on the servlet API since HttpServlertRequest and HttpServletResponse objects are passed to the execute() Method. But in struts2 any Java class with execute() method can be used as an Action Class. Actions to be neutral to the underlying framework
  5. ActionForms feature is no more known to the struts2 framework. Simple Java Bean flavored actions are used to put properties directly.
  6. Struts2 actions are HTTP independent and framework neutral. This enables to test struts2 applications very easily with out resorting mock objects.
  7. Struts2 tags enables to add style sheet driven markup capabilities.  ie. You can create consistent pages with less code. Struts2 tag markup can be altered by changing an underlying stylesheet.
  8. Struts tags are more capable and result oriented.
  9. Both JSP and Free maker tags are fully supported.
  10. Java 5 annotations can be used as an alternative to XML and Java properties configuration.
  11. Struts 2 check boxes do not require special handling for false values.
  12. Many changes can be done on fly without restarting the web container.
  13. Struts1 lets to customize the request processor per module. Struts2 lets to customize request handling per action if desired.
  14. Struts 2 Actions are spring aware. Just need to add spring beens.
  15. Struts2 extensions can be added by dropping in jar. No need of any addition XML or properties files. Metadata is expressed through convention and annotations.
Ajax support in Struts2:
  1. AJAX client side validation
  2. Remote form submission support (works with the submit tag as well)
  3. An advanced div template that provides dynamic reloading of partial HTML
  4. An advanced template that provides the ability to load and evaluate JavaScript remotely
  5. An AJAX-only tabbed Panel implementation
  6. A rich pub-sub event model
  7. Interactive auto complete tag
Struts1 and Struts2 at a glance:
Struts 1 vs. Struts 2
  1. Action                                    Action
  2. ActionForm                        Action or POJO
  3. ActionForward                  Result
  4. struts-config.xml              struts.xml
  5. ActionServlet                     FilterDispatcher
  6. RequestProcessor             Interceptors
  7. validation.xml                    Action-validation.xml