Struts Tutorial - Struts 2 Baby Step to Learn

Struts Tutorial
Hi in this struts tutorial we will discuss about struts 2 tutorial covers all the topics of Struts 2 Framework with simplified examples. The struts framework was initially created by Craig McClanahan and donated to Apache Foundation in May, 2000 and Struts 1.0 was released in June 2001. The current stable release of Struts is struts-2.3.15 in GA / June 3, 2013.


Struts 2 Framework
Apache Struts 2 is an elegant, extensible framework for creating enterprise-ready Java web applications. The framework is designed to streamline the full development cycle, from building, to deploying, to maintaining applications over time. Apache Struts 2 was originally known as WebWork 2.
Popular Spring Tutorials
  1. Spring Tutorial
  2. Spring MVC Web Tutorial
  3. Spring Boot Tutorial
  4. Spring JDBC Tutorial
  5. Spring AOP Tutorial
  6. Spring Security Tutorial

The Struts 2 framework is used to develop MVC (Model View Controller) based web applications. Struts 2 is the combination of webwork framework of opensymphony and struts1.

struts2 = webwork + struts1

The Struts 2 provides supports to POJO based actions, Validation Support, AJAX Support, Integration support to various frameworks such as Hibernate, Spring, Tiles etc, support to various result types such as Freemarker, Velocity, JSP etc. Struts2 is based on the Web works framework of OpenSymphony. 

Struts 2 Features 
The strut-2 framework is designed for the compilation of the entire development cycle including of building, developing and maintaining the whole application. It is very extensible as each class of the framework is based on an Interface and all the base classes are given an extra application and even you can add your own. The basic platform requirements are Servlet API 2.4, JSP API 2.0 and Java 5.


About Struts 2 Framework
About Struts 2 Request Flow
  1. The controller receives the user request and determine which Struts 2 action to invoke.
  2. The framework creates an instance of this action and associate it with the newly created instance of the ActionInvocation.
  3. In Struts 2 the invocation of action should pass through a series of interceptors as defined in the application's XML file.
  4. The framework calls the ActionInvocations invoke() method to start the execution of the action.
  5. Each time the invoke() method is called, ActionInvocation consults its state and executes whichever interceptor comes next.
  6. ActionInvocation hands control over to the interceptor in the stack by calling the interceptors intercept() method.
  7. The intercept() method of the interceptor intern calls the invoke() method of the ActionInvocation till all the interceptors are invoked, in the end the action itself will be called and the corresponding result will be returned back to the user.
  8. Some interceptor do work before the action is executed and some do work after the action is executed. It's not necessary that it should do something each time it is invoked.
  9. These interceptors are invoke both before and after the action.
  10. First all the interceptors are executed in the order they are defined in the stack.
  11. Then the action is invoked and the result is generated.
  12. Again all the interceptors present in the stack are invoked in the reverse order.
  13. The other important features of Struts 2 are OGNL and ValueStack.
  14. Object-Graph Navigation Language (OGNL) is a powerful expression language that is used to reference and manipulate data on the ValueStack.
  15. OGNL help in data transfer and type conversion.
  16. OGNL expression language provides simplified syntax to reference java objects.
  17. OGNL is used to bind the java-side data properties to the string-based view layer.
Struts 2 Tutorial

Architecture of Struts 2 Framework
Struts ValueStack


Struts 2 Basic
1 - Introduction To MVC
2 - Model 1 and Model 2(MVC) 
3 - Introduction to Struts 2
4 - Architecture of Struts 2
5 - Setting Up Struts 2 in Eclipse
6 - Writing a Struts 2 Hello World Application
7 - Struts 2 OGNL, ActionInvocation, ActionContex
8 - Configuration of Struts 2
9 - Understanding Namespaces
10 - A Tag And A Business Service
11 - The ValueStack in Struts 2
12 - Struts 2 Actions
13 - Struts 2 Interceptors
14 - Struts 2 Result Types
15 - Struts 2 File Uploads
16 - Struts 2 Database Access
17 - Struts 2 Sending Mails
18 - Struts 2 Validations
19 - Struts 2 Localization
20 - Struts 2 Themes/Templates 
21 - Struts 2 Exception Handling
22 - Struts 2 Annotations
Struts 2 Tags
1 - Struts 2 Control Tags
2 - Struts 2 Data Tags
3 - Struts 2 Form Tags
4 - Struts 2 Ajax Tags
Struts 2 Integrations
1 - Struts 2 with Spring 3 Integration
2 - Struts 2 with Tiles 2 Spring 3 Integration
3 - Struts 2 with Hibernate 3 Spring3 Tiles 2 Integration
4 - Struts 2 And JSON Example




References

Struts 2 - Welcome

Struts 2 -Wiki 

 

 

Labels: