SlideShare a Scribd company logo
1 of 23
How does struts work? Mohammad Seyed Alavi [email_address]
[object Object],[object Object],[object Object],[object Object],Document Map
User’s scenario ,[object Object]
Name: Submit Name: Submit Name: Submit Mohammad Mohammad Fill Form's Field Trigger the action Mohammad
Name: Submit Incorrect name Name: Submit Incorrect name Hamed Correct the name & trigger the action Mohammad Welcome ……………… Hamed
How does struts work? ,[object Object],[object Object]
Primitives ObjectName Attr=value Attr=value Attr=value ,[object Object],object maker ClassName ObjectName ,[object Object]
Primitives (cont.) ObjectName Attr=value Class.Method(args) Return value ,[object Object],ObjectName Attr=value Class.Method(args) ,[object Object]
[object Object]
Name: Submit Name: Submit Name: Submit Mohammad Mohammad Fill Form's Field Trigger the action name =“  ” Mohammad 1 <%@ taglib prefix=&quot;s&quot;  uri=&quot;/struts-tags&quot;%> <s:textfield  name=” name ”... entrance.jsp Find the name’s field name 2 field=“  ”
<s:form action =  “  ” . . . <action name = “  ” class =  “  ” method =  “  ”> . . . Find the action name  from “entrance.jsp” file Find the action class and method from &quot;struts.xml&quot; 1.name=“Mohammad” 2.action class=“  “ 3.action method=“  “ 1 3 5 2.action=“  “ 4 submit Entrance signIn submit Entrance signIn entrance.jsp struts.xml submit 1.field=“name” 2
Value Stack An object of action class will be created if there  is not any of that in  value stack object maker Entrance entrance entrance name =  “ Mohammad” There wasn't any object so make new one entrance_o Name =  “ Mohammad” entrance Entrance.setName(“Mohammad”) entrance name =  “ Mohammad” Entrance.setName(“Mohammad”) void call the setter name=“Mohammad” action class=“Entrance“ 3.action method=“signIn“ 1 3 5 2.action=“submit“ 4 3 1 2 field=“name” 2 3
Call the action method Return the return value entrance name =  “ Mohammad” Entrance.signIn() entrance name =  “ Mohammad” Entrance.signIn() “ No” name=“Mohammad” action class=“Entrance“ action method=“signIn“ 1 3 5 2.action=“submit“ 4 3 5 return value=  6 “ No” field=“name” 2
entrance name =  “ Mohammad” Value Stack Push the object on top of value stack name=“Mohammad” action class=“Entrance“ action method=“signIn“ 1 3 5 2.action=“submit“ 4 return value=“No” 6 field=“name” 2
<action name=“submit”> <result name = “ No ”> main.jsp?msg = “Incorrect name” </result> . . . </action> Find the target page  corresponding to return  value from “struts.xml” Name: Submit Go to the result page Incorrect name name=“Mohammad” action class=“Entrance“ action method=“signIn“ 1 2 3 action=“submit“ 4 return value=“No” 5 4 5 struts.xml field=“  ” 6 <%@ taglib prefix=&quot;s&quot;  uri=&quot;/struts-tags&quot;%> Name: <s:textfield  name=” name ”... entrance.jsp Find the name’s field name
Value Stack Find the object from the top of value stack to initialize the result page (first object that has “name” property)  entrance_o Name =  “ Mohammad” entrance entrance name =  “ Mohammad” Entrance.getName() entrance name =  “ Mohammad” Entrance.getName() “ Mohammad” Name: Submit Incorrect name Mohammad Name: Submit Incorrect name Hamed Correct the name & trigger the action name=“  ” action class=“Entrance“ action method=“signIn“ 5 2 3 action=“submit“ 4 Hamed 2 1 field=“name” 1 Retrieve name property from action object
1.name=“Hamed” 1 field=“  ” 2 <%@ taglib prefix=&quot;s&quot;  uri=&quot;/struts-tags&quot;%> Name: <s:textfield  name=” name ”... entrance.jsp name Find the name’s field
<s:form action =  “  ” . . . <action name = “  ” class =  “  ” method =  “  ”> . . . Find the action name  from “entrance.jsp” file Find the action class and method from &quot;struts.xml&quot; 1.name=“Hamed” 2.action class=“  “ 3.action method=“  “ 1 3 5 2.action=“  “ 4 submit Entrance signIn submit Entrance signIn entrance.jsp struts.xml submit field=“name” 2
Value Stack New Request So, new value stack object maker Entrance entrance entrance name =  “ Hamed” There wasn't any object so make new one entrance_o Name =  “ Mohammad” entrance Entrance.setName(“Hamed”) entrance name =  “ Hamed” Entrance.setName(“Hamed”) void call the setter name=“Hamed” action class=“Entrance“ 3.action method=“signIn“ 1 3 5 2.action=“submit“ 4 3 1 2 field=“name” 2 3
Call the action method Return the return value entrance name =  “ Hamed” Entrance.signIn() entrance name =  “ Hamed” Entrance.signIn() “ Yes” 1.name=“Hamed” action class=“Entrance“ action method=“signIn“ 1 3 5 action=“submit“ 4 return value=  6 “ Yes” 3 5 field=“name” 2
entrance name =  “ Hamed ” Value Stack Push the new object  name=“Hamed” action class=“Entrance“ action method=“signIn“ 1 3 5 action=“submit“ 4 return value=“Yes” 6 on top of value stack field=“name” 2
<action name=“submit”> <result name = “No”> … </result> <result name = “ Yes ”> welcome.jsp </result> </action> Find the target page  corresponding to return  value from “struts.xml” Go to the result page Welcome ……………… 5 name =“Hamed” action class=“Entrance“ action method=“signIn“ 1 2 3 action=“submit“ 4 return value=“Yes” 5 4 struts.xml <%@ taglib prefix=&quot;s&quot;  uri=&quot;/struts-tags&quot;%> Welcome <s:property  value=” name ”... welcome.jsp name field=“  ” 6
Value Stack Find the object from the top of value stack to initialize the result page (first object that has “name” property)  entrance_o Name =  “ Mohammad” entrance entrance name =  “ Hamed” Entrance.getName() entrance name =  “ Hamed” Entrance.getName() “ Hamed” Welcome ……………… Hamed 1.name=“Hamed” action class=“Entrance“ action method=“signIn“ 1 2 3 action=“submit“ 4 2 field=“name” 5 5 Retrieve name property  from action object

More Related Content

Viewers also liked

Struts2
Struts2Struts2
Struts2yuvalb
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2wiradikusuma
 
CM Pros CMIS Overview - Jan 2011
CM Pros CMIS Overview  - Jan 2011CM Pros CMIS Overview  - Jan 2011
CM Pros CMIS Overview - Jan 2011Laurence Hart
 
EMC World 2009 - Standards: CMIS
EMC World  2009 - Standards: CMISEMC World  2009 - Standards: CMIS
EMC World 2009 - Standards: CMISLaurence Hart
 
Contratti Distanza
Contratti DistanzaContratti Distanza
Contratti Distanzaguesta30844
 
An Open Approach to Information Governance
An Open Approach to Information GovernanceAn Open Approach to Information Governance
An Open Approach to Information GovernanceLaurence Hart
 
Content Management Market Trends
Content Management Market TrendsContent Management Market Trends
Content Management Market TrendsLaurence Hart
 
Class Is For Messy Clothes
Class Is For Messy ClothesClass Is For Messy Clothes
Class Is For Messy Clothesrusev
 
Removing the “Work” from Information Governance
Removing the “Work” from Information GovernanceRemoving the “Work” from Information Governance
Removing the “Work” from Information GovernanceLaurence Hart
 
Using Dita To Provide Consistent Communications To The Public
Using Dita To Provide Consistent Communications To The PublicUsing Dita To Provide Consistent Communications To The Public
Using Dita To Provide Consistent Communications To The PublicLaurence Hart
 
Streamlining Content Management Using Portal Technologies
Streamlining Content Management Using Portal TechnologiesStreamlining Content Management Using Portal Technologies
Streamlining Content Management Using Portal TechnologiesLaurence Hart
 
Ian Malone Basic Portfolio
Ian Malone  Basic PortfolioIan Malone  Basic Portfolio
Ian Malone Basic Portfolioianmalone
 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overviewskill-guru
 
Presentación Nico Calavita
Presentación Nico CalavitaPresentación Nico Calavita
Presentación Nico CalavitaVisnja Tomicic
 
SP2010 Overview and Upgrade Planning, Web Content Mavens
SP2010 Overview and Upgrade Planning, Web Content MavensSP2010 Overview and Upgrade Planning, Web Content Mavens
SP2010 Overview and Upgrade Planning, Web Content MavensLaurence Hart
 
The Future of Content Management - AIIM Conference 2011
The Future of Content Management - AIIM Conference 2011The Future of Content Management - AIIM Conference 2011
The Future of Content Management - AIIM Conference 2011Laurence Hart
 
Overview of CMIS in June 2010
Overview of CMIS in June 2010Overview of CMIS in June 2010
Overview of CMIS in June 2010Laurence Hart
 
Infection control powerpoint garnett
Infection control powerpoint garnettInfection control powerpoint garnett
Infection control powerpoint garnettrusev
 

Viewers also liked (20)

Struts2
Struts2Struts2
Struts2
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
CM Pros CMIS Overview - Jan 2011
CM Pros CMIS Overview  - Jan 2011CM Pros CMIS Overview  - Jan 2011
CM Pros CMIS Overview - Jan 2011
 
EMC World 2009 - Standards: CMIS
EMC World  2009 - Standards: CMISEMC World  2009 - Standards: CMIS
EMC World 2009 - Standards: CMIS
 
Contratti Distanza
Contratti DistanzaContratti Distanza
Contratti Distanza
 
An Open Approach to Information Governance
An Open Approach to Information GovernanceAn Open Approach to Information Governance
An Open Approach to Information Governance
 
Content Management Market Trends
Content Management Market TrendsContent Management Market Trends
Content Management Market Trends
 
Class Is For Messy Clothes
Class Is For Messy ClothesClass Is For Messy Clothes
Class Is For Messy Clothes
 
Struts2
Struts2Struts2
Struts2
 
Removing the “Work” from Information Governance
Removing the “Work” from Information GovernanceRemoving the “Work” from Information Governance
Removing the “Work” from Information Governance
 
Struts 2
Struts 2Struts 2
Struts 2
 
Using Dita To Provide Consistent Communications To The Public
Using Dita To Provide Consistent Communications To The PublicUsing Dita To Provide Consistent Communications To The Public
Using Dita To Provide Consistent Communications To The Public
 
Streamlining Content Management Using Portal Technologies
Streamlining Content Management Using Portal TechnologiesStreamlining Content Management Using Portal Technologies
Streamlining Content Management Using Portal Technologies
 
Ian Malone Basic Portfolio
Ian Malone  Basic PortfolioIan Malone  Basic Portfolio
Ian Malone Basic Portfolio
 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overview
 
Presentación Nico Calavita
Presentación Nico CalavitaPresentación Nico Calavita
Presentación Nico Calavita
 
SP2010 Overview and Upgrade Planning, Web Content Mavens
SP2010 Overview and Upgrade Planning, Web Content MavensSP2010 Overview and Upgrade Planning, Web Content Mavens
SP2010 Overview and Upgrade Planning, Web Content Mavens
 
The Future of Content Management - AIIM Conference 2011
The Future of Content Management - AIIM Conference 2011The Future of Content Management - AIIM Conference 2011
The Future of Content Management - AIIM Conference 2011
 
Overview of CMIS in June 2010
Overview of CMIS in June 2010Overview of CMIS in June 2010
Overview of CMIS in June 2010
 
Infection control powerpoint garnett
Infection control powerpoint garnettInfection control powerpoint garnett
Infection control powerpoint garnett
 

Similar to Struts 2 Second Scenario

Basic Object Oriented Concepts
Basic Object Oriented ConceptsBasic Object Oriented Concepts
Basic Object Oriented ConceptsScott Lee
 
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...Ho Chi Minh City Software Testing Club
 
Swift - Modern & Expressive, or Magical Unicorn?
Swift  - Modern & Expressive, or Magical Unicorn?Swift  - Modern & Expressive, or Magical Unicorn?
Swift - Modern & Expressive, or Magical Unicorn?Mike Jones
 
Javascript Primer
Javascript PrimerJavascript Primer
Javascript PrimerAdam Hepton
 
GeeCON Prague 2014 - Metaprogramming with Groovy
GeeCON Prague 2014 - Metaprogramming with GroovyGeeCON Prague 2014 - Metaprogramming with Groovy
GeeCON Prague 2014 - Metaprogramming with GroovyIván López Martín
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokusHamletDRC
 
Design Patterns the Ruby way - ConFoo 2015
Design Patterns the Ruby way - ConFoo 2015Design Patterns the Ruby way - ConFoo 2015
Design Patterns the Ruby way - ConFoo 2015Fred Heath
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using RoomNelson Glauber Leal
 
Best practices for crafting high quality PHP apps (Bulgaria 2019)
Best practices for crafting high quality PHP apps (Bulgaria 2019)Best practices for crafting high quality PHP apps (Bulgaria 2019)
Best practices for crafting high quality PHP apps (Bulgaria 2019)James Titcumb
 
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Scott Wlaschin
 
Groovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony CodeGroovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony Codestasimus
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScriptJulie Iskander
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Tsuyoshi Yamamoto
 
JavaScript In Object Oriented Way
JavaScript In Object Oriented WayJavaScript In Object Oriented Way
JavaScript In Object Oriented WayBorey Lim
 

Similar to Struts 2 Second Scenario (20)

Basic Object Oriented Concepts
Basic Object Oriented ConceptsBasic Object Oriented Concepts
Basic Object Oriented Concepts
 
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
 
Swift - Modern & Expressive, or Magical Unicorn?
Swift  - Modern & Expressive, or Magical Unicorn?Swift  - Modern & Expressive, or Magical Unicorn?
Swift - Modern & Expressive, or Magical Unicorn?
 
Scala taxonomy
Scala taxonomyScala taxonomy
Scala taxonomy
 
Javascript Primer
Javascript PrimerJavascript Primer
Javascript Primer
 
GeeCON Prague 2014 - Metaprogramming with Groovy
GeeCON Prague 2014 - Metaprogramming with GroovyGeeCON Prague 2014 - Metaprogramming with Groovy
GeeCON Prague 2014 - Metaprogramming with Groovy
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
 
Design Patterns the Ruby way - ConFoo 2015
Design Patterns the Ruby way - ConFoo 2015Design Patterns the Ruby way - ConFoo 2015
Design Patterns the Ruby way - ConFoo 2015
 
Scala introduction
Scala introductionScala introduction
Scala introduction
 
FalcorJS
FalcorJSFalcorJS
FalcorJS
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using Room
 
Best practices for crafting high quality PHP apps (Bulgaria 2019)
Best practices for crafting high quality PHP apps (Bulgaria 2019)Best practices for crafting high quality PHP apps (Bulgaria 2019)
Best practices for crafting high quality PHP apps (Bulgaria 2019)
 
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
 
Groovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony CodeGroovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony Code
 
Java 8 revealed
Java 8 revealedJava 8 revealed
Java 8 revealed
 
Clean Javascript
Clean JavascriptClean Javascript
Clean Javascript
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
Elegant objects
Elegant objectsElegant objects
Elegant objects
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 
JavaScript In Object Oriented Way
JavaScript In Object Oriented WayJavaScript In Object Oriented Way
JavaScript In Object Oriented Way
 

Recently uploaded

A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMANIlamathiKannappan
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876dlhescort
 
Call Girls in Gomti Nagar - 7388211116 - With room Service
Call Girls in Gomti Nagar - 7388211116  - With room ServiceCall Girls in Gomti Nagar - 7388211116  - With room Service
Call Girls in Gomti Nagar - 7388211116 - With room Servicediscovermytutordmt
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Dave Litwiller
 
Call Girls In Holiday Inn Express Gurugram➥99902@11544 ( Best price)100% Genu...
Call Girls In Holiday Inn Express Gurugram➥99902@11544 ( Best price)100% Genu...Call Girls In Holiday Inn Express Gurugram➥99902@11544 ( Best price)100% Genu...
Call Girls In Holiday Inn Express Gurugram➥99902@11544 ( Best price)100% Genu...lizamodels9
 
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...Suhani Kapoor
 
Understanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key InsightsUnderstanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key Insightsseri bangash
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataExhibitors Data
 
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 DelhiCall Girls in Delhi
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesDipal Arora
 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.Aaiza Hassan
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxAndy Lambert
 
HONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsHONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsMichael W. Hawkins
 
Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Roland Driesen
 
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779Delhi Call girls
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableDipal Arora
 
Progress Report - Oracle Database Analyst Summit
Progress  Report - Oracle Database Analyst SummitProgress  Report - Oracle Database Analyst Summit
Progress Report - Oracle Database Analyst SummitHolger Mueller
 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear RegressionRavindra Nath Shukla
 

Recently uploaded (20)

A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMAN
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
 
Call Girls in Gomti Nagar - 7388211116 - With room Service
Call Girls in Gomti Nagar - 7388211116  - With room ServiceCall Girls in Gomti Nagar - 7388211116  - With room Service
Call Girls in Gomti Nagar - 7388211116 - With room Service
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
 
Forklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Operations: Safety through Cartoons
Forklift Operations: Safety through Cartoons
 
Call Girls In Holiday Inn Express Gurugram➥99902@11544 ( Best price)100% Genu...
Call Girls In Holiday Inn Express Gurugram➥99902@11544 ( Best price)100% Genu...Call Girls In Holiday Inn Express Gurugram➥99902@11544 ( Best price)100% Genu...
Call Girls In Holiday Inn Express Gurugram➥99902@11544 ( Best price)100% Genu...
 
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
 
Understanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key InsightsUnderstanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key Insights
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors Data
 
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptx
 
HONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsHONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael Hawkins
 
Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...
 
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
 
Progress Report - Oracle Database Analyst Summit
Progress  Report - Oracle Database Analyst SummitProgress  Report - Oracle Database Analyst Summit
Progress Report - Oracle Database Analyst Summit
 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear Regression
 

Struts 2 Second Scenario

  • 1. How does struts work? Mohammad Seyed Alavi [email_address]
  • 2.
  • 3.
  • 4. Name: Submit Name: Submit Name: Submit Mohammad Mohammad Fill Form's Field Trigger the action Mohammad
  • 5. Name: Submit Incorrect name Name: Submit Incorrect name Hamed Correct the name & trigger the action Mohammad Welcome ……………… Hamed
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. Name: Submit Name: Submit Name: Submit Mohammad Mohammad Fill Form's Field Trigger the action name =“ ” Mohammad 1 <%@ taglib prefix=&quot;s&quot; uri=&quot;/struts-tags&quot;%> <s:textfield name=” name ”... entrance.jsp Find the name’s field name 2 field=“ ”
  • 11. <s:form action = “ ” . . . <action name = “ ” class = “ ” method = “ ”> . . . Find the action name from “entrance.jsp” file Find the action class and method from &quot;struts.xml&quot; 1.name=“Mohammad” 2.action class=“ “ 3.action method=“ “ 1 3 5 2.action=“ “ 4 submit Entrance signIn submit Entrance signIn entrance.jsp struts.xml submit 1.field=“name” 2
  • 12. Value Stack An object of action class will be created if there is not any of that in value stack object maker Entrance entrance entrance name = “ Mohammad” There wasn't any object so make new one entrance_o Name = “ Mohammad” entrance Entrance.setName(“Mohammad”) entrance name = “ Mohammad” Entrance.setName(“Mohammad”) void call the setter name=“Mohammad” action class=“Entrance“ 3.action method=“signIn“ 1 3 5 2.action=“submit“ 4 3 1 2 field=“name” 2 3
  • 13. Call the action method Return the return value entrance name = “ Mohammad” Entrance.signIn() entrance name = “ Mohammad” Entrance.signIn() “ No” name=“Mohammad” action class=“Entrance“ action method=“signIn“ 1 3 5 2.action=“submit“ 4 3 5 return value= 6 “ No” field=“name” 2
  • 14. entrance name = “ Mohammad” Value Stack Push the object on top of value stack name=“Mohammad” action class=“Entrance“ action method=“signIn“ 1 3 5 2.action=“submit“ 4 return value=“No” 6 field=“name” 2
  • 15. <action name=“submit”> <result name = “ No ”> main.jsp?msg = “Incorrect name” </result> . . . </action> Find the target page corresponding to return value from “struts.xml” Name: Submit Go to the result page Incorrect name name=“Mohammad” action class=“Entrance“ action method=“signIn“ 1 2 3 action=“submit“ 4 return value=“No” 5 4 5 struts.xml field=“ ” 6 <%@ taglib prefix=&quot;s&quot; uri=&quot;/struts-tags&quot;%> Name: <s:textfield name=” name ”... entrance.jsp Find the name’s field name
  • 16. Value Stack Find the object from the top of value stack to initialize the result page (first object that has “name” property) entrance_o Name = “ Mohammad” entrance entrance name = “ Mohammad” Entrance.getName() entrance name = “ Mohammad” Entrance.getName() “ Mohammad” Name: Submit Incorrect name Mohammad Name: Submit Incorrect name Hamed Correct the name & trigger the action name=“ ” action class=“Entrance“ action method=“signIn“ 5 2 3 action=“submit“ 4 Hamed 2 1 field=“name” 1 Retrieve name property from action object
  • 17. 1.name=“Hamed” 1 field=“ ” 2 <%@ taglib prefix=&quot;s&quot; uri=&quot;/struts-tags&quot;%> Name: <s:textfield name=” name ”... entrance.jsp name Find the name’s field
  • 18. <s:form action = “ ” . . . <action name = “ ” class = “ ” method = “ ”> . . . Find the action name from “entrance.jsp” file Find the action class and method from &quot;struts.xml&quot; 1.name=“Hamed” 2.action class=“ “ 3.action method=“ “ 1 3 5 2.action=“ “ 4 submit Entrance signIn submit Entrance signIn entrance.jsp struts.xml submit field=“name” 2
  • 19. Value Stack New Request So, new value stack object maker Entrance entrance entrance name = “ Hamed” There wasn't any object so make new one entrance_o Name = “ Mohammad” entrance Entrance.setName(“Hamed”) entrance name = “ Hamed” Entrance.setName(“Hamed”) void call the setter name=“Hamed” action class=“Entrance“ 3.action method=“signIn“ 1 3 5 2.action=“submit“ 4 3 1 2 field=“name” 2 3
  • 20. Call the action method Return the return value entrance name = “ Hamed” Entrance.signIn() entrance name = “ Hamed” Entrance.signIn() “ Yes” 1.name=“Hamed” action class=“Entrance“ action method=“signIn“ 1 3 5 action=“submit“ 4 return value= 6 “ Yes” 3 5 field=“name” 2
  • 21. entrance name = “ Hamed ” Value Stack Push the new object name=“Hamed” action class=“Entrance“ action method=“signIn“ 1 3 5 action=“submit“ 4 return value=“Yes” 6 on top of value stack field=“name” 2
  • 22. <action name=“submit”> <result name = “No”> … </result> <result name = “ Yes ”> welcome.jsp </result> </action> Find the target page corresponding to return value from “struts.xml” Go to the result page Welcome ……………… 5 name =“Hamed” action class=“Entrance“ action method=“signIn“ 1 2 3 action=“submit“ 4 return value=“Yes” 5 4 struts.xml <%@ taglib prefix=&quot;s&quot; uri=&quot;/struts-tags&quot;%> Welcome <s:property value=” name ”... welcome.jsp name field=“ ” 6
  • 23. Value Stack Find the object from the top of value stack to initialize the result page (first object that has “name” property) entrance_o Name = “ Mohammad” entrance entrance name = “ Hamed” Entrance.getName() entrance name = “ Hamed” Entrance.getName() “ Hamed” Welcome ……………… Hamed 1.name=“Hamed” action class=“Entrance“ action method=“signIn“ 1 2 3 action=“submit“ 4 2 field=“name” 5 5 Retrieve name property from action object