SlideShare a Scribd company logo
1 of 8
Struts Ppt 1 - Presentation Transcript<br />STRUTS Jaya Prakash...<br />Struts Agenda<br />Software Crises<br />What is Framework<br />Model1,Model2<br />What is Struts<br />Why we need it<br />Why is it called as Struts<br />Advantages of Struts<br />Terminology of Struts<br />Architecture of Struts<br />Controller Elements & itโ€™s Responsibilities<br />Model Elements & itโ€™s Responsibilities<br />View Elements & itโ€™s<br />Responsibilities<br />Struts sequence diagram<br />I18n<br />Disadvantages<br />Challenges Exist In Software Development & Software Crisis<br />Projects must be developed Quickly.<br />Projects must be in High-Quality.<br />Application Stability.<br />Better code Maintainability.<br />Lower Cost for Developing Application.<br />To solve above Challenges<br />The Software Development Community Introduced Frameworks to Guide Development.<br />* Time shown with out day light savings<br />What is Framework<br />A software framework is a re-usable design for a software system (or subsystem).<br />A framework is a pre-built assembly of components and is designed to be extended.<br />It is also base for components.<br />Advantages of Framework<br />Provide a procedure for the development of Application.<br />Saves developers Time.<br />Provides same approach for all developers for developing code and Consistency in Software Design<br />Provide low-level services that developers can use to speedup development.<br />It also reduces software development and maintenance costs.<br />Most of the frameworks follow Model1,Model2<br />Model 1<br />In the Model 1 the JSP page is responsible for processing the incoming request and replying back to the client.<br />Disadvantages of Model1<br />It does not have separate controller<br />This Architecture usually leads to a significant amount of Java code embedded within the JSP page<br />Model 1 architecture is suitable for applications that have very simple page flow, have little need for centralized and change little over time.<br />Developers Designers JSP<br />Developers and designers must work on the same files!<br />Model 2<br />This Model2 approach combines the use of both servlets and JSP, using JSP to generate the presentation layer and servlets to perform process-intensive tasks.<br />Model2 architecture introduces a Servlet between the browser and the JSP pages.<br />The servlet acts as the controller and is in charge of the request processing and the creation of any beans or objects used by the JSP, as well as deciding, depending on the user's actions, which JSP page to forward the request to.<br />Model2 Advantages<br />No processing/business logic within the JSP page.<br />Model 2 applications are easier to maintain and extend, because views do not refer to each other directly.<br />The Model 2 controller servlet provides a single point of control for security and often encapsulates incoming data into a form usable by the back-end MVC model.<br />It also Provides unique responsibility to each component and each is independent of the other component .<br />Change in one component will have no or less impact on other components.<br />Model 2 Components and Responsibilities<br />Model<br />The Model portion of an MVC-based System responsible for internal state of the system, and actions that can be taken to change that state<br />Decide โ€œ How to do โ€<br />Controller<br />-Decide โ€œ What to do โ€<br />-The Controller portion of the application is focused on receiving requests from the client ,deciding what business logic is to be performed ,and then delegating responsibility for producing the next phase of user interface to an appropriate View Component<br />View<br />Presentation<br />What is Struts<br />An open source web application framework based on j2ee and java which implements the MVC design pattern is called Struts.<br />Why is it called as Struts<br />Strut synonym is Iron-rod.<br />Why we use and what are the advantages of Struts<br />It is open source.<br />Provides components for building Web Applications that speedup development and saves time for developers.<br />It makes complex applications into simple.<br />Built in Exception Handling<br />I18n support with resource bundles.<br />Built in validation framework.<br />It also have tiles framework (A template mechanism incorporated into struts for managing page layouts.)<br />Struts Architecture<br />Struts Framework Components<br />Controller Components - Direct the Action<br />Model Components - Access Data and Systems<br />View Components - What the users see<br />Struts Controller Components<br />Struts-config.xml<br />Actionservlet and Requestprocessor<br />Receive the HttpServletRequest<br />Automatically populate a JavaBean from the request parameters.<br />Handle Locale Issues<br />Determine which Action to invoke based on URI<br />Extends javax.servlet.http.HttpServlet<br />Receives all framework requests<br />Selects proper application module<br />Delegates request handling to the RequestProcessor instance<br />One ActionServlet instance per web application<br />Default implementation provided by Framework<br />Actionservlet and Requestprocessor<br />ActionServlet dispatch request to Request Processor(New from 1.1. previous this behaviour was in Action servlet)<br />The work of Request Processor is:-<br />Finding ActionMapping.<br />Mapping Action to FormBean.<br />Creating FormBean Object.<br />Calling reset() method of FormBean<br />Calling Validator of FormBean<br />If no form(jsp/html) validation errors calls execute method in Action Class and finding response to request.<br />If Errors give the errors on jsp present in input attribute of Action tag in struts-config.xml.<br />What is An Action Class<br />Extends org.apache.struts.action.Action<br />Overrides the execute() method<br />Acts as a bridge between user-invoked URI and a business method<br />Return information about which view should be rendered next<br />Part of the Controller ,not the Model<br />Actionclass Example<br />Struts-Config.xml<br />The power and flexibility of struts is due to the extracting of configuration information from across frame work.<br />Configuration file contains action mappings (determines navigation)<br />Controller uses mappings to turn HTTP requests into application actions<br />Mapping must specify<br />A request path<br />Object type to act upon the request<br />Tags in this file are:-<br />Data Sources.<br />Form Beans.<br />Global Exceptions.<br />Global Forwards<br />Actions<br />Controller<br />Message resources<br />Plug-in<br />Struts- Config.xml Example<br />The Model Components<br />Model Components<br />Java classes<br />middle tier components (EJB, Javabeans, โ€ฆ)<br />database access components<br />Used to represent the Internal state of the system<br />Actions that can change that state<br />Internal state of system represented by<br />JavaBeans<br />Enterprise JavaBeans<br />Action Form<br />Extends the ActionForm class<br />Create one for each input form in the application<br />It is just like a java bean, Store data temporary, reset default values to views, validate input view.<br />Hold state and behavior for user input.<br />If defined in the ActionMapping configuration file, the Controller Servlet will perform the following:-<br />Check for instance of bean of appropriate class<br />If no bean exists, one is created automatically<br />For every request parameter whose name corresponds to the name of a property in the bean, the corresponding setter method will be called<br />The updated ActionForm bean will be passed to the Action Class execute () method when it is called, making these values immediately available.<br />ActionForm Example<br />The View Components<br />Struts JSP Tag Libraries<br />HTML<br />Bean<br />Logic<br />Nested<br />Tiles<br />Template<br />Html Tag & Bean Tag Libraries<br />Tags used to create Struts input forms<br />Examples (checkbox,image,<br />link, submit ,text, text area)<br />Tags used for accessing JavaBeans and their properties<br />Examples (Define,message,write)<br />Logic ,Tiles & Nested Tag Libraries<br />Managing conditional generation of output text<br />Looping over object Collections for repetitive generation of output text<br />Example (empty,lessThan,<br />greaterThan)<br />Extended the base struts tags to allow them to relate to each other in nested nature<br />Tiles tags<br />Each part (&quot;Tile&quot;) of webpage can be reused as often as needed throughout your application. This reduces the amount of markup that needs to be maintained and makes it easier to change the look and feel of a website.<br />Template Tag Library<br />The &quot;struts-template&quot; tag library contains tags that are useful in creating dynamic JSP templates for pages which share a common format. These templates are best used when it is likely that a layout shared by several pages in your application will change. The functionality provided by these tags is similar to what can be achieved using standard JSP include directive , but are dynamic rather than static.<br />Note: As of Struts 1.1 the template library has been deprecated<br />Action Message & Action Error<br />Used to signify general purpose informational and error messages<br />Rely on the resource bundles<br />JSP Tags can access them<br /></html:errors><br />Internationalization Support<br />Much of the framework functionality based on java.util.Locale<br />Struts Uses Java Resource Bundles .<br />Ex:-<br />Date ,Time and Currency Formatting<br />Currency Conversion<br />Resource Bundle Example<br />Other Features Suported by Struts Framework<br />Multi-Module Support<br />Declarative Exception-Handling<br />Dynamic Action Forms<br />Plugins<br />Tiles integrated With Core<br />Validator Integrated With Core<br />Struts Sequence Diagram<br />Struts Example<br />0.167.192.116login_app<br />Webapps|<br />|sample(Application Name)<br />|__ login.jsp<br />|__newLogin.Jsp<br />|__success.jsp<br />|__WEB-INF<br />|__web.xml<br />|__Struts-config.xml<br /> All the struts tld files|__*.tld <br />|__lib<br /> All the jar files|__*.jar <br />|__classes<br />|__LoginAction,LoginForm,<br />Messageresorces<br />Disadvantages<br />Bigger Learning Curve<br />Not Based on Domain Model<br />Property Names<br />Views are restricted .<br />Questions & Answers QUESTIONS & ANSWERS What did I Miss?<br />Thank u mail me:-jayaprakash.m.java@gmail.com<br />
Struts ppt 1
Struts ppt 1
Struts ppt 1
Struts ppt 1
Struts ppt 1
Struts ppt 1
Struts ppt 1

More Related Content

What's hot

Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Application
elliando dias
ย 
Struts Introduction Course
Struts Introduction CourseStruts Introduction Course
Struts Introduction Course
guest764934
ย 
Struts2
Struts2Struts2
Struts2
shankar_b7
ย 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
ย 

What's hot (20)

Struts introduction
Struts introductionStruts introduction
Struts introduction
ย 
Struts(mrsurwar) ppt
Struts(mrsurwar) pptStruts(mrsurwar) ppt
Struts(mrsurwar) ppt
ย 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overview
ย 
Struts presentation
Struts presentationStruts presentation
Struts presentation
ย 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Application
ย 
Struts course material
Struts course materialStruts course material
Struts course material
ย 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
ย 
Struts & hibernate ppt
Struts & hibernate pptStruts & hibernate ppt
Struts & hibernate ppt
ย 
Struts2
Struts2Struts2
Struts2
ย 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
ย 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
ย 
Apache Struts 2 Framework
Apache Struts 2 FrameworkApache Struts 2 Framework
Apache Struts 2 Framework
ย 
Struts & spring framework issues
Struts & spring framework issuesStruts & spring framework issues
Struts & spring framework issues
ย 
Struts Introduction Course
Struts Introduction CourseStruts Introduction Course
Struts Introduction Course
ย 
Struts2
Struts2Struts2
Struts2
ย 
Struts2
Struts2Struts2
Struts2
ย 
Struts Interview Questions
Struts Interview QuestionsStruts Interview Questions
Struts Interview Questions
ย 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
ย 
TY.BSc.IT Java QB U6
TY.BSc.IT Java QB U6TY.BSc.IT Java QB U6
TY.BSc.IT Java QB U6
ย 
Just a View: An Introduction To Model-View-Controller Pattern
Just a View:  An Introduction To Model-View-Controller PatternJust a View:  An Introduction To Model-View-Controller Pattern
Just a View: An Introduction To Model-View-Controller Pattern
ย 

Similar to Struts ppt 1

MVC
MVCMVC
MVC
akshin
ย 
Krazykoder struts2 intro
Krazykoder struts2 introKrazykoder struts2 intro
Krazykoder struts2 intro
Krazy Koder
ย 
Struts N E W
Struts N E WStruts N E W
Struts N E W
patinijava
ย 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
Long Nguyen
ย 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
divzi1913
ย 
important struts interview questions
important struts interview questionsimportant struts interview questions
important struts interview questions
surendray
ย 
Ibm
IbmIbm
Ibm
techbed
ย 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source Frameworks
Sunil Patil
ย 
D22 portlet development with open source frameworks
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworks
Sunil Patil
ย 
Apachecon 2002 Struts
Apachecon 2002 StrutsApachecon 2002 Struts
Apachecon 2002 Struts
yesprakash
ย 
What is the difference between struts 1 vs struts 2
What is the difference between struts 1 vs struts 2What is the difference between struts 1 vs struts 2
What is the difference between struts 1 vs struts 2
Santosh Singh Paliwal
ย 

Similar to Struts ppt 1 (20)

J2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for womenJ2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for women
ย 
MVC
MVCMVC
MVC
ย 
Krazykoder struts2 intro
Krazykoder struts2 introKrazykoder struts2 intro
Krazykoder struts2 intro
ย 
Struts Interceptors
Struts InterceptorsStruts Interceptors
Struts Interceptors
ย 
Struts N E W
Struts N E WStruts N E W
Struts N E W
ย 
Skillwise Struts.x
Skillwise Struts.xSkillwise Struts.x
Skillwise Struts.x
ย 
Struts
StrutsStruts
Struts
ย 
Struts2.x
Struts2.xStruts2.x
Struts2.x
ย 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
ย 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
ย 
important struts interview questions
important struts interview questionsimportant struts interview questions
important struts interview questions
ย 
Ibm
IbmIbm
Ibm
ย 
141060753008 3715301
141060753008 3715301141060753008 3715301
141060753008 3715301
ย 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
ย 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source Frameworks
ย 
D22 portlet development with open source frameworks
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworks
ย 
Apachecon 2002 Struts
Apachecon 2002 StrutsApachecon 2002 Struts
Apachecon 2002 Struts
ย 
Struts
StrutsStruts
Struts
ย 
What is the difference between struts 1 vs struts 2
What is the difference between struts 1 vs struts 2What is the difference between struts 1 vs struts 2
What is the difference between struts 1 vs struts 2
ย 
Struts interview-questions-ppt
Struts interview-questions-pptStruts interview-questions-ppt
Struts interview-questions-ppt
ย 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
ย 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
ย 

Recently uploaded (20)

Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
ย 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
ย 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
ย 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
ย 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
ย 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
ย 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
ย 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
ย 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
ย 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
ย 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
ย 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
ย 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
ย 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
ย 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
ย 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
ย 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
ย 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
ย 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
ย 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
ย 

Struts ppt 1

  • 1. Struts Ppt 1 - Presentation Transcript<br />STRUTS Jaya Prakash...<br />Struts Agenda<br />Software Crises<br />What is Framework<br />Model1,Model2<br />What is Struts<br />Why we need it<br />Why is it called as Struts<br />Advantages of Struts<br />Terminology of Struts<br />Architecture of Struts<br />Controller Elements & itโ€™s Responsibilities<br />Model Elements & itโ€™s Responsibilities<br />View Elements & itโ€™s<br />Responsibilities<br />Struts sequence diagram<br />I18n<br />Disadvantages<br />Challenges Exist In Software Development & Software Crisis<br />Projects must be developed Quickly.<br />Projects must be in High-Quality.<br />Application Stability.<br />Better code Maintainability.<br />Lower Cost for Developing Application.<br />To solve above Challenges<br />The Software Development Community Introduced Frameworks to Guide Development.<br />* Time shown with out day light savings<br />What is Framework<br />A software framework is a re-usable design for a software system (or subsystem).<br />A framework is a pre-built assembly of components and is designed to be extended.<br />It is also base for components.<br />Advantages of Framework<br />Provide a procedure for the development of Application.<br />Saves developers Time.<br />Provides same approach for all developers for developing code and Consistency in Software Design<br />Provide low-level services that developers can use to speedup development.<br />It also reduces software development and maintenance costs.<br />Most of the frameworks follow Model1,Model2<br />Model 1<br />In the Model 1 the JSP page is responsible for processing the incoming request and replying back to the client.<br />Disadvantages of Model1<br />It does not have separate controller<br />This Architecture usually leads to a significant amount of Java code embedded within the JSP page<br />Model 1 architecture is suitable for applications that have very simple page flow, have little need for centralized and change little over time.<br />Developers Designers JSP<br />Developers and designers must work on the same files!<br />Model 2<br />This Model2 approach combines the use of both servlets and JSP, using JSP to generate the presentation layer and servlets to perform process-intensive tasks.<br />Model2 architecture introduces a Servlet between the browser and the JSP pages.<br />The servlet acts as the controller and is in charge of the request processing and the creation of any beans or objects used by the JSP, as well as deciding, depending on the user's actions, which JSP page to forward the request to.<br />Model2 Advantages<br />No processing/business logic within the JSP page.<br />Model 2 applications are easier to maintain and extend, because views do not refer to each other directly.<br />The Model 2 controller servlet provides a single point of control for security and often encapsulates incoming data into a form usable by the back-end MVC model.<br />It also Provides unique responsibility to each component and each is independent of the other component .<br />Change in one component will have no or less impact on other components.<br />Model 2 Components and Responsibilities<br />Model<br />The Model portion of an MVC-based System responsible for internal state of the system, and actions that can be taken to change that state<br />Decide โ€œ How to do โ€<br />Controller<br />-Decide โ€œ What to do โ€<br />-The Controller portion of the application is focused on receiving requests from the client ,deciding what business logic is to be performed ,and then delegating responsibility for producing the next phase of user interface to an appropriate View Component<br />View<br />Presentation<br />What is Struts<br />An open source web application framework based on j2ee and java which implements the MVC design pattern is called Struts.<br />Why is it called as Struts<br />Strut synonym is Iron-rod.<br />Why we use and what are the advantages of Struts<br />It is open source.<br />Provides components for building Web Applications that speedup development and saves time for developers.<br />It makes complex applications into simple.<br />Built in Exception Handling<br />I18n support with resource bundles.<br />Built in validation framework.<br />It also have tiles framework (A template mechanism incorporated into struts for managing page layouts.)<br />Struts Architecture<br />Struts Framework Components<br />Controller Components - Direct the Action<br />Model Components - Access Data and Systems<br />View Components - What the users see<br />Struts Controller Components<br />Struts-config.xml<br />Actionservlet and Requestprocessor<br />Receive the HttpServletRequest<br />Automatically populate a JavaBean from the request parameters.<br />Handle Locale Issues<br />Determine which Action to invoke based on URI<br />Extends javax.servlet.http.HttpServlet<br />Receives all framework requests<br />Selects proper application module<br />Delegates request handling to the RequestProcessor instance<br />One ActionServlet instance per web application<br />Default implementation provided by Framework<br />Actionservlet and Requestprocessor<br />ActionServlet dispatch request to Request Processor(New from 1.1. previous this behaviour was in Action servlet)<br />The work of Request Processor is:-<br />Finding ActionMapping.<br />Mapping Action to FormBean.<br />Creating FormBean Object.<br />Calling reset() method of FormBean<br />Calling Validator of FormBean<br />If no form(jsp/html) validation errors calls execute method in Action Class and finding response to request.<br />If Errors give the errors on jsp present in input attribute of Action tag in struts-config.xml.<br />What is An Action Class<br />Extends org.apache.struts.action.Action<br />Overrides the execute() method<br />Acts as a bridge between user-invoked URI and a business method<br />Return information about which view should be rendered next<br />Part of the Controller ,not the Model<br />Actionclass Example<br />Struts-Config.xml<br />The power and flexibility of struts is due to the extracting of configuration information from across frame work.<br />Configuration file contains action mappings (determines navigation)<br />Controller uses mappings to turn HTTP requests into application actions<br />Mapping must specify<br />A request path<br />Object type to act upon the request<br />Tags in this file are:-<br />Data Sources.<br />Form Beans.<br />Global Exceptions.<br />Global Forwards<br />Actions<br />Controller<br />Message resources<br />Plug-in<br />Struts- Config.xml Example<br />The Model Components<br />Model Components<br />Java classes<br />middle tier components (EJB, Javabeans, โ€ฆ)<br />database access components<br />Used to represent the Internal state of the system<br />Actions that can change that state<br />Internal state of system represented by<br />JavaBeans<br />Enterprise JavaBeans<br />Action Form<br />Extends the ActionForm class<br />Create one for each input form in the application<br />It is just like a java bean, Store data temporary, reset default values to views, validate input view.<br />Hold state and behavior for user input.<br />If defined in the ActionMapping configuration file, the Controller Servlet will perform the following:-<br />Check for instance of bean of appropriate class<br />If no bean exists, one is created automatically<br />For every request parameter whose name corresponds to the name of a property in the bean, the corresponding setter method will be called<br />The updated ActionForm bean will be passed to the Action Class execute () method when it is called, making these values immediately available.<br />ActionForm Example<br />The View Components<br />Struts JSP Tag Libraries<br />HTML<br />Bean<br />Logic<br />Nested<br />Tiles<br />Template<br />Html Tag & Bean Tag Libraries<br />Tags used to create Struts input forms<br />Examples (checkbox,image,<br />link, submit ,text, text area)<br />Tags used for accessing JavaBeans and their properties<br />Examples (Define,message,write)<br />Logic ,Tiles & Nested Tag Libraries<br />Managing conditional generation of output text<br />Looping over object Collections for repetitive generation of output text<br />Example (empty,lessThan,<br />greaterThan)<br />Extended the base struts tags to allow them to relate to each other in nested nature<br />Tiles tags<br />Each part (&quot;Tile&quot;) of webpage can be reused as often as needed throughout your application. This reduces the amount of markup that needs to be maintained and makes it easier to change the look and feel of a website.<br />Template Tag Library<br />The &quot;struts-template&quot; tag library contains tags that are useful in creating dynamic JSP templates for pages which share a common format. These templates are best used when it is likely that a layout shared by several pages in your application will change. The functionality provided by these tags is similar to what can be achieved using standard JSP include directive , but are dynamic rather than static.<br />Note: As of Struts 1.1 the template library has been deprecated<br />Action Message & Action Error<br />Used to signify general purpose informational and error messages<br />Rely on the resource bundles<br />JSP Tags can access them<br /></html:errors><br />Internationalization Support<br />Much of the framework functionality based on java.util.Locale<br />Struts Uses Java Resource Bundles .<br />Ex:-<br />Date ,Time and Currency Formatting<br />Currency Conversion<br />Resource Bundle Example<br />Other Features Suported by Struts Framework<br />Multi-Module Support<br />Declarative Exception-Handling<br />Dynamic Action Forms<br />Plugins<br />Tiles integrated With Core<br />Validator Integrated With Core<br />Struts Sequence Diagram<br />Struts Example<br />0.167.192.116login_app<br />Webapps|<br />|sample(Application Name)<br />|__ login.jsp<br />|__newLogin.Jsp<br />|__success.jsp<br />|__WEB-INF<br />|__web.xml<br />|__Struts-config.xml<br /> All the struts tld files|__*.tld <br />|__lib<br /> All the jar files|__*.jar <br />|__classes<br />|__LoginAction,LoginForm,<br />Messageresorces<br />Disadvantages<br />Bigger Learning Curve<br />Not Based on Domain Model<br />Property Names<br />Views are restricted .<br />Questions & Answers QUESTIONS & ANSWERS What did I Miss?<br />Thank u mail me:-jayaprakash.m.java@gmail.com<br />