Struts2

2,149 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,149
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
98
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Struts2

  1. 1. Struts 2
  2. 2. Contents <ul><li>What is Struts? </li></ul><ul><li>Why to use framework? </li></ul><ul><li>Struts 2 Overview </li></ul><ul><li>Struts 2 MVC components </li></ul><ul><li>Request Lifecycle in Struts 2 </li></ul><ul><li>Struts 2 Architecture </li></ul><ul><li>Sample Application </li></ul><ul><li>Why we should use Struts 2? </li></ul><ul><li>Struts 1 vs Struts 2 </li></ul><ul><li>What you need to start using Struts2. </li></ul>
  3. 3. What is Struts? <ul><li>Open Source java framework for creating web applications. </li></ul><ul><li>Action Based Framework </li></ul><ul><li>Create web application using MVC 2 architecture </li></ul><ul><li>Apache Struts offer two major version </li></ul><ul><ul><ul><li>Struts 1.x </li></ul></ul></ul><ul><ul><ul><li>Struts 2.0 </li></ul></ul></ul><ul><li>Struts 2 = WebWork + Struts </li></ul>
  4. 4. Why use framework? <ul><li>Do we need framework? </li></ul><ul><li>No and Yes. </li></ul><ul><li>No. </li></ul><ul><li>In small applications where you don’t want the overhead of learning new things. </li></ul><ul><li>But </li></ul><ul><li>Yes </li></ul><ul><li>We have to use framework in real world application because:- </li></ul><ul><ul><li>Automation of common tasks </li></ul></ul><ul><ul><li>Concentrate on higher level concerns. </li></ul></ul>
  5. 5. Struts 2 <ul><li>Complete new framework based on webwork framework. </li></ul><ul><li>Struts 2 implements MVC 2 design pattern. </li></ul>
  6. 6. Struts 2 MVC Components <ul><li>Controller:- </li></ul><ul><li>Filter Dispatcher:- </li></ul><ul><ul><li>First component that start processing that is why this type of MVC is called front controller MVC </li></ul></ul><ul><ul><li>Looks at the request and apply the appropriate action. </li></ul></ul><ul><ul><li>Struts framework handles all of the controller work. </li></ul></ul><ul><ul><li>Its configured in web.xml </li></ul></ul><ul><li>Interceptors:- </li></ul><ul><ul><li>Can execute code before and after an Action is executed. </li></ul></ul><ul><ul><li>They can be configured per action basis. </li></ul></ul><ul><ul><li>Can be used for data validation, file upload, double submit guards. </li></ul></ul>
  7. 7. Struts 2 MVC Components contd. <ul><li>Model:- </li></ul><ul><ul><li>Implemented by action class </li></ul></ul><ul><ul><li>For model you can use any data access technologies like JDBC,EJB,Hibernate </li></ul></ul><ul><li>View </li></ul><ul><ul><li>Its your result part. It can be JSP,JSTL,JSF etc. </li></ul></ul><ul><ul><li>Presentation part of the MVC </li></ul></ul>
  8. 8. Request Lifecycle in Struts 2 <ul><li>User Sends Request </li></ul><ul><li>Filter Dispatcher determines the appropriate action </li></ul><ul><li>Interceptors are applied </li></ul><ul><li>Execution of action </li></ul><ul><li>Output Rendering </li></ul><ul><li>Return of Request </li></ul><ul><li>Display of result to user. </li></ul>
  9. 9. Struts 2 Architecture
  10. 10. Why we should use Struts 2? <ul><li>Simplified Design </li></ul><ul><li>Simplified Action </li></ul><ul><li>Simplified Testability </li></ul><ul><li>Better tag features </li></ul><ul><li>Annotation introduced </li></ul><ul><li>Easy plug-in </li></ul><ul><li>AJAX Support </li></ul>
  11. 11. Struts 1 vs Struts 2 <ul><li>How Struts 1 and Struts 2 differ from each other? </li></ul><ul><ul><li>Configuration </li></ul></ul><ul><ul><li>Action Class </li></ul></ul><ul><ul><li>Dependency injection. </li></ul></ul><ul><ul><li>Servlet Dependency </li></ul></ul><ul><ul><li>Validation </li></ul></ul><ul><ul><li>Threading model </li></ul></ul><ul><ul><li>Testability </li></ul></ul><ul><ul><li>Expression Language </li></ul></ul>
  12. 12. What you need to start using Struts 2? <ul><li>Java 5.0 </li></ul><ul><li>Tomcat 5.x(Servlet api 2.4 and jsp api 2.0) </li></ul>
  13. 13. <ul><li>Thank You All. </li></ul>

×