1. What is Struts?
2. Why to use framework?
3. Struts 2.0 Overview
4. Struts 2.0 MVC components
5. Request Lifecycle in Struts 2
6. Struts 2.0 Architecture
7. Sample Application
8. Why we should use Struts 2.0?
9. Struts 1.x vs Struts 2.0
10. What you need to start using Struts2.0
Open Source java framework for
creating web applications.
Action Based Framework
Create web application using MVC 2
Apache Struts offer two major version
Struts 2 = WebWork + Struts
What is Struts?
Do we need framework?
No and Yes.
In small applications where you don’t want
the overhead of learning new things.
We have to use framework in real world
Automation of common tasks
Concentrate on higher level concerns.
Why use framework?
Complete new framework based on webwork framework.
Struts 2.0 implements MVC 2 design pattern.
First component that start processing that is why this type
of MVC is called front controller MVC
Looks at the request and apply the appropriate action.
Struts framework handles all of the controller work.
Its configured in web.xml
Can execute code before and after an Action is
They can be configured per action basis.
Can be used for data validation, file upload, double
Struts 2.0 MVC Components
Implemented by action class
For model you can use any data access
technologies like JDBC,EJB,Hibernate
Its your result part. It can be JSP,JSTL,JSF etc.
Presentation part of the MVC
Struts 2.0 MVC Components contd.
1. User Sends Request
2. Filter Dispatcher determines the appropriate action
3. Interceptors are applied
4. Execution of action
5. Output Rendering
6. Return of Request
7. Display of result to user.
Request Lifecycle in Struts 2.0
1. Simplified Design
2. Simplified Action
3. Simplified Testability
4. Better tag features
5. Annotation introduced
6. Easy plug-in
7. AJAX Support
Why we should use Struts
How Struts 1.x and Struts 2.0 differ from each
› Action Class
› Dependency injection.
› Servlet Dependency
› Threading model
› Expression Language
Struts 1.x vs Struts 2.0
Brian Kernighan Law of
Debugging is twice as hard as writing the
code in the first place. Therefore, if you
write the code as cleverly as possible, you
are, by definition, not smart enough to