WebWork 2 is now Apache Struts 2

By: Rajan Emailed: 1646 times Printed: 2113 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

Apache Struts 2 was originally knows as WebWork 2. WebWork was functioning independantly for many years until recently both Struts and Webwork communities joined hands to create Struts2.

To download the framework, visit Apache Struts Distributions

Apache Struts 2 Architecture:

1. The web browser requests a resource (/mypage.action, /reports/myreport.pdf, et cetera) 
2. The Filter Dispatcher looks at the request and determines the appropriate Action 
3. The Interceptors automatically apply common functionality to the request, like workflow, validation, and file upload handling 
4. The Action method executes, usually storing and/or retrieving information from a database 
5. The Result renders the output to the browser, be it HTML, images, PDF, or something else 

Struts 2 Configuration:

A web application uses a deployment descriptor to initialize resources like filters and listeners. The web deployment descriptor is formatted as a XML document and named web.xml. Struts can either initializes its resources by scanning your classes using Java packages declared in this web.xml file, or you can have full control over the configuration via a configuration file, named struts.xml. These resources include action mappings, to direct input to server-side Action classes, and result types, to select output pages. 

Here's a typical configuration (struts.xml) for a login workflow:

<struts>
<package name="default" extends="struts-default">

<action name="Logon" class="mailreader2.Logon">
<result name="input">/pages/Logon.jsp</result>
<result name="cancel" type="redirect-action">Welcome</result>
<result type="redirect-action">MainMenu</result>
<result name="expired" type="chain">ChangePassword</result>
</action>

<action name="Logoff" class="mailreader2.Logoff">
<result type="redirect-action">Welcome</result>
</action>

</package>
</struts>
The framework provides general-purpose defaults, so we can start using Struts right away, "out of the box". Any factory defaults can be overridden in an application's configuration, as needed.

Apache Struts 2 requires:

  • Servlet API 2.4
  • JSP API 2.0
  • Java 5
An alternate set of JARs for Java 4 are also available. See the "J4" distribution. For a full list of requirements, including dependencies used by optional plugins, see Project Dependencies

Struts Home | All Struts Tutorials | Latest Struts Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Rajan
WebWork 2 is now Apache Struts 2
Using JDBC to connect to MySQL from Java Program
Execute system commands in a Java Program
Cookies using JSP or Java Bean
Sample Java Script that displays a movable clock
Java Chat Client Sample Applet

More Tutorials in Struts
Configuring JDBC DataSources in Struts
Struts Classes
FAQ: Why was reload removed from Struts (since 1.1)?
FAQ: Why are my checkboxes not being set from ON to OFF?
Using JavaScript to submit a form in Struts
How to prepopulate a form in Struts
Simple example of using the requiredif Validator rule in Struts
Chaining actions in Struts
When is the best time to validate input in Struts
What is a Plug-in and how to use Java plug-ins with Struts?
7 Best Practices of Struts
Origin and Architecture of Struts
ActionErrors and ActionError in Struts
Tutorial on Struts Configuration File - struts-config.xml in Struts - from the book: Struts Survival Guide. Basics to Best Practices
Handling multiple buttons in HTML Form in Struts

More Latest News
Most Viewed Articles (in Struts )
Tutorial on Struts Configuration File - struts-config.xml in Struts - from the book: Struts Survival Guide. Basics to Best Practices
7 Best Practices of Struts
What is Struts? Which Version of Struts to use?
IncludeAction in Struts
History of Struts
Writing the first Struts application
Is Struts the most popular web application framework for Java?
Configuring JDBC DataSources in Struts
Editing web.xml in a Struts Application
Struts 1 vs Struts 2
MVC with configurable controller
Struts and Tiles - Steps to use Struts and Tiles
Using Checkbox & Radio Tags, html:select, html:options in Struts Forms
Use ImageButtonBean for Image based Form Submits in Struts
ActionErrors and ActionError in Struts
Most Emailed Articles (in Struts)
History of Struts
The directories and files of a Struts application
ActionErrors and ActionError in Struts
What is a Model View Controller (MVC) Model?
Installing and configuring Tomcat and Struts
Creating the first application using Struts 2
Model 1 Architecture
Using Checkbox & Radio Tags, html:select, html:options in Struts Forms
WebWork 2 is now Apache Struts 2
Struts 1 vs Struts 2
Using Multibox in Struts
ForwardAction in Struts
Using JavaScript to submit a form in Struts
What is Struts? Which Version of Struts to use?
Configuring JDBC DataSources in Struts