SlideShare a Scribd company logo
1 of 23
Download to read offline
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

Fabric RFID Wristbands in Ireland for Events and Festivals
Fabric RFID Wristbands in Ireland for Events and FestivalsFabric RFID Wristbands in Ireland for Events and Festivals
Fabric RFID Wristbands in Ireland for Events and FestivalsWristbands Ireland
 
Boat Trailers Market PPT: Growth, Outlook, Demand, Keyplayer Analysis and Opp...
Boat Trailers Market PPT: Growth, Outlook, Demand, Keyplayer Analysis and Opp...Boat Trailers Market PPT: Growth, Outlook, Demand, Keyplayer Analysis and Opp...
Boat Trailers Market PPT: Growth, Outlook, Demand, Keyplayer Analysis and Opp...IMARC Group
 
The End of Business as Usual: Rewire the Way You Work to Succeed in the Consu...
The End of Business as Usual: Rewire the Way You Work to Succeed in the Consu...The End of Business as Usual: Rewire the Way You Work to Succeed in the Consu...
The End of Business as Usual: Rewire the Way You Work to Succeed in the Consu...Brian Solis
 
Trauma Training Service for First Responders
Trauma Training Service for First RespondersTrauma Training Service for First Responders
Trauma Training Service for First RespondersBPOQe
 
NASA CoCEI Scaling Strategy - November 2023
NASA CoCEI Scaling Strategy - November 2023NASA CoCEI Scaling Strategy - November 2023
NASA CoCEI Scaling Strategy - November 2023Steve Rader
 
Team B Mind Map for Organizational Chg..
Team B Mind Map for Organizational Chg..Team B Mind Map for Organizational Chg..
Team B Mind Map for Organizational Chg..dlewis191
 
Data skills for Agile Teams- Killing story points
Data skills for Agile Teams- Killing story pointsData skills for Agile Teams- Killing story points
Data skills for Agile Teams- Killing story pointsyasinnathani
 
MC Heights construction company in Jhang
MC Heights construction company in JhangMC Heights construction company in Jhang
MC Heights construction company in Jhangmcgroupjeya
 
7movierulz.uk
7movierulz.uk7movierulz.uk
7movierulz.ukaroemirsr
 
Borderless Access - Global B2B Panel book-unlock 2024
Borderless Access - Global B2B Panel book-unlock 2024Borderless Access - Global B2B Panel book-unlock 2024
Borderless Access - Global B2B Panel book-unlock 2024Borderless Access
 
Lecture_6.pptx English speaking easyb to
Lecture_6.pptx English speaking easyb toLecture_6.pptx English speaking easyb to
Lecture_6.pptx English speaking easyb toumarfarooquejamali32
 
HELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptx
HELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptxHELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptx
HELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptxHelene Heckrotte
 
Ethical stalking by Mark Williams. UpliftLive 2024
Ethical stalking by Mark Williams. UpliftLive 2024Ethical stalking by Mark Williams. UpliftLive 2024
Ethical stalking by Mark Williams. UpliftLive 2024Winbusinessin
 
UNLEASHING THE POWER OF PROGRAMMATIC ADVERTISING
UNLEASHING THE POWER OF PROGRAMMATIC ADVERTISINGUNLEASHING THE POWER OF PROGRAMMATIC ADVERTISING
UNLEASHING THE POWER OF PROGRAMMATIC ADVERTISINGlokeshwarmaha
 
Developing Coaching Skills: Mine, Yours, Ours
Developing Coaching Skills: Mine, Yours, OursDeveloping Coaching Skills: Mine, Yours, Ours
Developing Coaching Skills: Mine, Yours, OursKaiNexus
 
Michael Vidyakin: Introduction to PMO (UA)
Michael Vidyakin: Introduction to PMO (UA)Michael Vidyakin: Introduction to PMO (UA)
Michael Vidyakin: Introduction to PMO (UA)Lviv Startup Club
 
NewBase 25 March 2024 Energy News issue - 1710 by Khaled Al Awadi_compress...
NewBase  25 March  2024  Energy News issue - 1710 by Khaled Al Awadi_compress...NewBase  25 March  2024  Energy News issue - 1710 by Khaled Al Awadi_compress...
NewBase 25 March 2024 Energy News issue - 1710 by Khaled Al Awadi_compress...Khaled Al Awadi
 
Upgrade Your Banking Experience with Advanced Core Banking Applications
Upgrade Your Banking Experience with Advanced Core Banking ApplicationsUpgrade Your Banking Experience with Advanced Core Banking Applications
Upgrade Your Banking Experience with Advanced Core Banking ApplicationsIntellect Design Arena Ltd
 
Scrum Events & How to run them effectively
Scrum Events & How to run them effectivelyScrum Events & How to run them effectively
Scrum Events & How to run them effectivelyMarianna Nakou
 
PDT 89 - $1.4M - Seed - Plantee Innovations.pdf
PDT 89 - $1.4M - Seed - Plantee Innovations.pdfPDT 89 - $1.4M - Seed - Plantee Innovations.pdf
PDT 89 - $1.4M - Seed - Plantee Innovations.pdfHajeJanKamps
 

Recently uploaded (20)

Fabric RFID Wristbands in Ireland for Events and Festivals
Fabric RFID Wristbands in Ireland for Events and FestivalsFabric RFID Wristbands in Ireland for Events and Festivals
Fabric RFID Wristbands in Ireland for Events and Festivals
 
Boat Trailers Market PPT: Growth, Outlook, Demand, Keyplayer Analysis and Opp...
Boat Trailers Market PPT: Growth, Outlook, Demand, Keyplayer Analysis and Opp...Boat Trailers Market PPT: Growth, Outlook, Demand, Keyplayer Analysis and Opp...
Boat Trailers Market PPT: Growth, Outlook, Demand, Keyplayer Analysis and Opp...
 
The End of Business as Usual: Rewire the Way You Work to Succeed in the Consu...
The End of Business as Usual: Rewire the Way You Work to Succeed in the Consu...The End of Business as Usual: Rewire the Way You Work to Succeed in the Consu...
The End of Business as Usual: Rewire the Way You Work to Succeed in the Consu...
 
Trauma Training Service for First Responders
Trauma Training Service for First RespondersTrauma Training Service for First Responders
Trauma Training Service for First Responders
 
NASA CoCEI Scaling Strategy - November 2023
NASA CoCEI Scaling Strategy - November 2023NASA CoCEI Scaling Strategy - November 2023
NASA CoCEI Scaling Strategy - November 2023
 
Team B Mind Map for Organizational Chg..
Team B Mind Map for Organizational Chg..Team B Mind Map for Organizational Chg..
Team B Mind Map for Organizational Chg..
 
Data skills for Agile Teams- Killing story points
Data skills for Agile Teams- Killing story pointsData skills for Agile Teams- Killing story points
Data skills for Agile Teams- Killing story points
 
MC Heights construction company in Jhang
MC Heights construction company in JhangMC Heights construction company in Jhang
MC Heights construction company in Jhang
 
7movierulz.uk
7movierulz.uk7movierulz.uk
7movierulz.uk
 
Borderless Access - Global B2B Panel book-unlock 2024
Borderless Access - Global B2B Panel book-unlock 2024Borderless Access - Global B2B Panel book-unlock 2024
Borderless Access - Global B2B Panel book-unlock 2024
 
Lecture_6.pptx English speaking easyb to
Lecture_6.pptx English speaking easyb toLecture_6.pptx English speaking easyb to
Lecture_6.pptx English speaking easyb to
 
HELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptx
HELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptxHELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptx
HELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptx
 
Ethical stalking by Mark Williams. UpliftLive 2024
Ethical stalking by Mark Williams. UpliftLive 2024Ethical stalking by Mark Williams. UpliftLive 2024
Ethical stalking by Mark Williams. UpliftLive 2024
 
UNLEASHING THE POWER OF PROGRAMMATIC ADVERTISING
UNLEASHING THE POWER OF PROGRAMMATIC ADVERTISINGUNLEASHING THE POWER OF PROGRAMMATIC ADVERTISING
UNLEASHING THE POWER OF PROGRAMMATIC ADVERTISING
 
Developing Coaching Skills: Mine, Yours, Ours
Developing Coaching Skills: Mine, Yours, OursDeveloping Coaching Skills: Mine, Yours, Ours
Developing Coaching Skills: Mine, Yours, Ours
 
Michael Vidyakin: Introduction to PMO (UA)
Michael Vidyakin: Introduction to PMO (UA)Michael Vidyakin: Introduction to PMO (UA)
Michael Vidyakin: Introduction to PMO (UA)
 
NewBase 25 March 2024 Energy News issue - 1710 by Khaled Al Awadi_compress...
NewBase  25 March  2024  Energy News issue - 1710 by Khaled Al Awadi_compress...NewBase  25 March  2024  Energy News issue - 1710 by Khaled Al Awadi_compress...
NewBase 25 March 2024 Energy News issue - 1710 by Khaled Al Awadi_compress...
 
Upgrade Your Banking Experience with Advanced Core Banking Applications
Upgrade Your Banking Experience with Advanced Core Banking ApplicationsUpgrade Your Banking Experience with Advanced Core Banking Applications
Upgrade Your Banking Experience with Advanced Core Banking Applications
 
Scrum Events & How to run them effectively
Scrum Events & How to run them effectivelyScrum Events & How to run them effectively
Scrum Events & How to run them effectively
 
PDT 89 - $1.4M - Seed - Plantee Innovations.pdf
PDT 89 - $1.4M - Seed - Plantee Innovations.pdfPDT 89 - $1.4M - Seed - Plantee Innovations.pdf
PDT 89 - $1.4M - Seed - Plantee Innovations.pdf
 

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