Apache Struts - Web Framework
Apache Struts is a free open-source framework for creating Java web applications.
Web applications differ from conventional websites in that web applications can create a dynamic response. Many websites deliver only static pages. A web application can interact with databases and business logic engines to customize a response.
Web applications based on JavaServer Pages sometimes commingle database code, page design code, and control flow code. In practice, we find that unless these concerns are separated, larger applications become difficult to maintain.
One way to separate concerns in a software application is to use a Model-View-Controller (MVC) architecture. The Model represents the business or database code, the View represents the page design code, and the Controller represents the navigational code. The Struts framework is designed to help developers create web applications that utilize a MVC architecture.
The framework provides three key components:
* A "request" handler provided by the application developer that is mapped to a standard URI.
* A "response" handler that transfers control to another resource which completes the response.
* A tag library that helps developers create interactive form-based applications with server pages.
The framework's architecture and tags are buzzword compliant. Struts works well with conventional REST applications and with nouveau technologies like SOAP and AJAX.
The Apache Struts Project is the open source community that creates and maintains the Apache Struts framework. The project consists of a diverse group of volunteers who share common values regarding collaborative, community-based open source development. The Apache Struts Project is proud to share these values with our parent organization: The Apache Software Foundation.
The project is called "Struts" because the framework is meant to furnish the "invisible underpinnings" that support professional application development. Struts provides the glue that joins the various elements of the standard Java platform into a coherent whole. Our goal is to leverage existing standards by producing the missing pieces we need to create enterprise-grade applications that are easy to maintain over time.
The Apache Struts Project offers two major versions of the Struts framework. Struts 1 is recognized as the most popular web application framework for Java. The 1.x framework is mature, well-documented, and widely supported. Struts 1 is the best choice for teams who value proven solutions to common problems.
Struts 2 was originally known as WebWork 2. After working independently for several years, the WebWork and Struts communities joined forces to create Struts 2. The 2.x framework is the best choice for teams who value elegant solutions to difficult problems.
Model-View-Controller(MVC)
Web applications based on JavaServer Pages sometimes commingle database code, page design code, and control flow code. In practice, we find that unless these concerns are separated, larger applications become difficult to maintain.
One way to separate concerns in a software application is to use a Model-View-Controller (MVC) architecture. The Model represents the business or database code, the View represents the page design code, and the Controller represents the navigational code.
The term "MVC" originated with the SmallTalk Model-View-Controller framework. In Smalltalk MVC, the View updates itself from the Model, via the "Observer" pattern. The original MVC pattern is like a closed loop: The View talks to the Controller, which talks to the Model, which talks to the View.
But, a direct link between the Model and the View is not practical for web applications, and we modify the classic MVC arrangement so that it would look less like a loop and more like a horseshoe with the controller in the middle.
In the MVC/Model 2 design pattern, application flow is mediated by a central Controller. The Controller delegates requests - in our case, HTTP requests - to an appropriate handler. The handlers are tied to a Model, and each handler acts as an adapter between the request and the Model. The Model represents, or encapsulates, an application's business logic or state. Control is usually then forwarded back through the Controller to the appropriate View. The forwarding can be determined by consulting a set of mappings, usually loaded from a database or configuration file. This provides a loose coupling between the View and Model, which can make applications significantly easier to create and maintain.
While MVC is a convenient paradigm, many workers find that applcations may utilize more than three layers. For example, within the Model, there is often distinct business logic and data access layers.
The framework provides the control layer for a Model 2 web applications. Developers can use this layer with other standard technologies to build the business, data access, and presentation layers.
Apache Struts Features
* Build!
o Easy startup - Jumpstart new projects with our bootstrap tutorial and template application or Maven archetype.
o Improved Design - Code clean against HTTP-independant framework interfaces.
o Enhanced Tags - Code less with stylesheet-driven form tags that provide their own markup.
o Stateful Checkboxes - Avoid special handling with smart checkboxes that know when they are toggled.
o Flexible Cancel Buttons - Go directly to a different action on cancel.
o First-class AJAX support - Add interactivity and flexibility with AJAX tags that look and feel just like standard Struts tags.
o Easy Spring integration - Inject dependencies into Actions using Spring without glue code or red tape. (Plexus support also available.)
o Enhanced Results - Do more with speciality results for JasperReports, JFreeChart, Action chaining, and file downloading.
o POJO forms - No more ActionForms! Use any JavaBean to capture form input or put properties directly on an Action class. Use both binary and String properties!
o POJO Actions - Use any class as an Action class -- even the interface is optional!
* Deploy!
o Easy plugins - Add framework extensions by dropping in a JAR. No manual configuration required! Bundled plugins add support for JavaServer Faces, JasperReports, JFreeChart, Tiles, and more ...
o Integrated profiling - Peek inside Struts2 to find where the cycles are going!
o Precise Error Reporting - Flip directly to the location and line of an error.
* Maintain!
o Easy-to-test Actions - Test Struts2 Actions directly, without resorting to mock HTTP objects.
o Intelligent Defaults - Skip obvious and redundant settings. Most framework configuration elements have a default value that we can set and forget. Say it once!
o Easy-to-customize controller - Customize the request handling per action, if desired. Struts2 only does what you want it to do!
o Integrating Debugging - Research problem reports with built-in debugging tools.
o Easy-to-tweak tags - Customize tag markup by editing a FreeMarker template. No need to grok the taglib API! JSP, FreeMarker, and Velocity tags are fully supported.
Struts Home Page
http://struts.apache.org/
Struts Documentation
http://struts.apache.org/primer.html
Download Struts 2.x
http://struts.apache.org/2.x/index.html
Struts 2.x Documents