SlideShare a Scribd company logo
1 of 26
Introducing
Spring Web Flow
Emad Omara
1
May 30, 2016
Agenda
• Why do we need SWF ?
• What is SWF ?
• How it works ?
• Demo
2
The Navigation problem !
 response.sendRedirect(“page.jsp");
 Spring MVC :
@RequestMapping("/operation")
public String processOperationPage() { return “/corpus/operation"; }
- Struts
<action-mappings> …. <forward name="name" path="/name.jsp"/> </ action-mappings>
- JSF
<navigation-rule><navigation-case>
<from-outcome>page2</from-outcome>
<to-view-id>/page2.xhtml</to-view-id>
</navigation-case> </navigation-rule> 3
Disadvantages
 Visualizing the flow is very difficult
 Mixed navigation and view
 Overall navigation rules complexity
 Lack of state control/navigation customization
4
What is Spring Web Flow?
 Spring MVC extension
 Introduces flows concept
 Extends application scopes
 Web flows are designed to be self contained, and thus
are reusable multiple of times
 UML Like diagram 
5
Important Classes
 FlowDefinition - This class stores the definition of the flow. It contains the set of states that form
part of the flow. Each flow has one start state.
 FlowRegistry - This class contains all the flow definitions.
 FlowHandlerMapping - This is a HandlerMapping that creates a URL from the ids registered in the
flow registry. It returns a FlowHandler if a matching id is found in the flow registry.
 FlowHandler - This is a controller helper that has the reference to the actual flow. It handles the
execution of the flow, its outcomes and exceptions.
 FlowHandlerAdapter - This is the HandlerAdapter for web flows. It delegates work to the mapped
FlowHandler.
 FlowExecutor - This is the central class of the Flow and is the facade for the actual flow. It manages
creating of new flows or resuming existing flows. It is an entry into the Spring web flow system.
6
Request Diagram
System Setup
 Web Flow schema :
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.4.xsd">
<!-- Setup Web Flow here -->
</beans>
8
System Setup 2 (Flow Registry)
URL : /WEB-INF/flows/hotels/booking/booking-flow.xml
9
Flow ID=/hotels/booking
Flow ID=springpizza
Flow ID=pizza
System Setup 3
10
Flow
 A flow defines a dialogue, between users and server that meets business goal
11
Flow Essential elements
 State
 Transition
 Flow data
 Expression language
12
Flow States
 View States : A view state displays information to a user or obtains user input using a
form. (e.g. JSP)
 Action States : Action states are where actions are perfomed by the spring beans. The
action state transitions to another state. The action states generally have an evaluate
property that describes what needs to be done.
 Decision States: A decision state has two transitions depending on whether the
decision evaluates to true or false.
 Subflow States :It may be advantageous to call another flow from one flow to
complete some steps. Passing inputs and expecting outputs.
 End States : The end state signifies the end of flow. If the end state is part of a root flow
then the execution is ended. However, if its part of a sub flow then the root flow is resumed.
13
Flow Data Scopes
 Flow Data can be stored as variables that can be created using the 'var' element.
 Variable scope - The lifespan of the variable depends on the scope with which it is declared. The
scopes available are:
 Request - Available during the life of a request in a flow
 Flash -Extended request scope for PRG case , Useful for rendering error/warning messages
 View - Available only during the lifetime of a view. Created when a view is created and destroyed once a
view is destroyed
 Flow - Available within a flow. Not available in sub flows
 Conversation - The conversation scope starts when a flow starts and ends when the flow ends. It is available
in sub flows
14
Flow elements
15
View State
16
Decision State
17
Action State
18
Sub Flow State
19
Input attributes
20
Output Value
21
Firing Events
22
Events
23
References
 Web Flow reference
 http://static.springframework.org/spring-webflow/docs/2.3.x/reference/html/index.html
 samples
 https://github.com/spring-projects/spring-webflow-samples
 Spring Web Flow 2 Web Development
 https://www.safaribooksonline.com/library/view/spring-web-flow/9781847195425/pr01.html
 Refcardz
 http://refcardz.dzone.com/refcardz/spring-web-flow
24
Demo
25
Thank you
Emad
26

More Related Content

What's hot

Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVC
Guy Nir
 
Using Java to implement SOAP Web Services: JAX-WS
Using Java to implement SOAP Web Services: JAX-WS�Using Java to implement SOAP Web Services: JAX-WS�
Using Java to implement SOAP Web Services: JAX-WS
Katrien Verbert
 
Java Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkJava Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC Framework
Guo Albert
 

What's hot (20)

Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVC
 
Using Java to implement SOAP Web Services: JAX-WS
Using Java to implement SOAP Web Services: JAX-WS�Using Java to implement SOAP Web Services: JAX-WS�
Using Java to implement SOAP Web Services: JAX-WS
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
JSF Component Behaviors
JSF Component BehaviorsJSF Component Behaviors
JSF Component Behaviors
 
Lecture 7 Web Services JAX-WS & JAX-RS
Lecture 7   Web Services JAX-WS & JAX-RSLecture 7   Web Services JAX-WS & JAX-RS
Lecture 7 Web Services JAX-WS & JAX-RS
 
Interoperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSITInteroperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSIT
 
Basic example using message properties component
Basic example using message properties componentBasic example using message properties component
Basic example using message properties component
 
Java API for XML Web Services (JAX-WS)
Java API for XML Web Services (JAX-WS)Java API for XML Web Services (JAX-WS)
Java API for XML Web Services (JAX-WS)
 
Java web application development
Java web application developmentJava web application development
Java web application development
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - Basics
 
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
 
SpringMVC
SpringMVCSpringMVC
SpringMVC
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
 
9. java server faces
9. java server faces9. java server faces
9. java server faces
 
Spring Web Services
Spring Web ServicesSpring Web Services
Spring Web Services
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Lecture 10 - Java Server Faces (JSF)
Lecture 10 - Java Server Faces (JSF)Lecture 10 - Java Server Faces (JSF)
Lecture 10 - Java Server Faces (JSF)
 
Jax ws
Jax wsJax ws
Jax ws
 
Rest with Spring
Rest with SpringRest with Spring
Rest with Spring
 
Java Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkJava Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC Framework
 

Viewers also liked (7)

Formation Google App Engine
Formation Google App EngineFormation Google App Engine
Formation Google App Engine
 
Front–End Tools for Dynamic Reconfiguration in FPGA Devices 2005
Front–End Tools for Dynamic Reconfiguration in FPGA Devices 2005Front–End Tools for Dynamic Reconfiguration in FPGA Devices 2005
Front–End Tools for Dynamic Reconfiguration in FPGA Devices 2005
 
FPGA_Overview_Ibr_2014
FPGA_Overview_Ibr_2014FPGA_Overview_Ibr_2014
FPGA_Overview_Ibr_2014
 
FPGA/Reconfigurable computing (HPRC)
FPGA/Reconfigurable computing (HPRC)FPGA/Reconfigurable computing (HPRC)
FPGA/Reconfigurable computing (HPRC)
 
fpga programming
fpga programmingfpga programming
fpga programming
 
Xilinx lca and altera flex
Xilinx lca and altera flexXilinx lca and altera flex
Xilinx lca and altera flex
 
Fpga
FpgaFpga
Fpga
 

Similar to Introduction to Srping Web Flow

WS-VLAM workflow
WS-VLAM workflowWS-VLAM workflow
WS-VLAM workflow
guest6295d0
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applications
elliando dias
 

Similar to Introduction to Srping Web Flow (20)

Spring MVC 5 & Hibernate 5 Integration
Spring MVC 5 & Hibernate 5 IntegrationSpring MVC 5 & Hibernate 5 Integration
Spring MVC 5 & Hibernate 5 Integration
 
Sprint Portlet MVC Seminar
Sprint Portlet MVC SeminarSprint Portlet MVC Seminar
Sprint Portlet MVC Seminar
 
Basic example using for each component
Basic example using for each componentBasic example using for each component
Basic example using for each component
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVC
 
Spring Web Flow
Spring Web FlowSpring Web Flow
Spring Web Flow
 
Spark Streaming Recipes and "Exactly Once" Semantics Revised
Spark Streaming Recipes and "Exactly Once" Semantics RevisedSpark Streaming Recipes and "Exactly Once" Semantics Revised
Spark Streaming Recipes and "Exactly Once" Semantics Revised
 
6 10-presentation
6 10-presentation6 10-presentation
6 10-presentation
 
Struts Action
Struts ActionStruts Action
Struts Action
 
Spring Web Flow Grail's Plugin
Spring Web Flow Grail's PluginSpring Web Flow Grail's Plugin
Spring Web Flow Grail's Plugin
 
WS-VLAM workflow
WS-VLAM workflowWS-VLAM workflow
WS-VLAM workflow
 
Jsf Framework
Jsf FrameworkJsf Framework
Jsf Framework
 
Jlook web ui framework
Jlook web ui frameworkJlook web ui framework
Jlook web ui framework
 
Splitter
SplitterSplitter
Splitter
 
Spring mvc 2.0
Spring mvc 2.0Spring mvc 2.0
Spring mvc 2.0
 
Guide to Spring Reactive Programming using WebFlux
Guide to Spring Reactive Programming using WebFluxGuide to Spring Reactive Programming using WebFlux
Guide to Spring Reactive Programming using WebFlux
 
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
 
JavaEE6 my way
JavaEE6 my wayJavaEE6 my way
JavaEE6 my way
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applications
 
How to use soap component
How to use soap componentHow to use soap component
How to use soap component
 
Network visibility and control using industry standard sFlow telemetry
Network visibility and control using industry standard sFlow telemetryNetwork visibility and control using industry standard sFlow telemetry
Network visibility and control using industry standard sFlow telemetry
 

Recently uploaded

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 

Recently uploaded (20)

Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 

Introduction to Srping Web Flow

  • 1. Introducing Spring Web Flow Emad Omara 1 May 30, 2016
  • 2. Agenda • Why do we need SWF ? • What is SWF ? • How it works ? • Demo 2
  • 3. The Navigation problem !  response.sendRedirect(“page.jsp");  Spring MVC : @RequestMapping("/operation") public String processOperationPage() { return “/corpus/operation"; } - Struts <action-mappings> …. <forward name="name" path="/name.jsp"/> </ action-mappings> - JSF <navigation-rule><navigation-case> <from-outcome>page2</from-outcome> <to-view-id>/page2.xhtml</to-view-id> </navigation-case> </navigation-rule> 3
  • 4. Disadvantages  Visualizing the flow is very difficult  Mixed navigation and view  Overall navigation rules complexity  Lack of state control/navigation customization 4
  • 5. What is Spring Web Flow?  Spring MVC extension  Introduces flows concept  Extends application scopes  Web flows are designed to be self contained, and thus are reusable multiple of times  UML Like diagram  5
  • 6. Important Classes  FlowDefinition - This class stores the definition of the flow. It contains the set of states that form part of the flow. Each flow has one start state.  FlowRegistry - This class contains all the flow definitions.  FlowHandlerMapping - This is a HandlerMapping that creates a URL from the ids registered in the flow registry. It returns a FlowHandler if a matching id is found in the flow registry.  FlowHandler - This is a controller helper that has the reference to the actual flow. It handles the execution of the flow, its outcomes and exceptions.  FlowHandlerAdapter - This is the HandlerAdapter for web flows. It delegates work to the mapped FlowHandler.  FlowExecutor - This is the central class of the Flow and is the facade for the actual flow. It manages creating of new flows or resuming existing flows. It is an entry into the Spring web flow system. 6
  • 8. System Setup  Web Flow schema : <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:webflow="http://www.springframework.org/schema/webflow-config" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.4.xsd"> <!-- Setup Web Flow here --> </beans> 8
  • 9. System Setup 2 (Flow Registry) URL : /WEB-INF/flows/hotels/booking/booking-flow.xml 9 Flow ID=/hotels/booking Flow ID=springpizza Flow ID=pizza
  • 11. Flow  A flow defines a dialogue, between users and server that meets business goal 11
  • 12. Flow Essential elements  State  Transition  Flow data  Expression language 12
  • 13. Flow States  View States : A view state displays information to a user or obtains user input using a form. (e.g. JSP)  Action States : Action states are where actions are perfomed by the spring beans. The action state transitions to another state. The action states generally have an evaluate property that describes what needs to be done.  Decision States: A decision state has two transitions depending on whether the decision evaluates to true or false.  Subflow States :It may be advantageous to call another flow from one flow to complete some steps. Passing inputs and expecting outputs.  End States : The end state signifies the end of flow. If the end state is part of a root flow then the execution is ended. However, if its part of a sub flow then the root flow is resumed. 13
  • 14. Flow Data Scopes  Flow Data can be stored as variables that can be created using the 'var' element.  Variable scope - The lifespan of the variable depends on the scope with which it is declared. The scopes available are:  Request - Available during the life of a request in a flow  Flash -Extended request scope for PRG case , Useful for rendering error/warning messages  View - Available only during the lifetime of a view. Created when a view is created and destroyed once a view is destroyed  Flow - Available within a flow. Not available in sub flows  Conversation - The conversation scope starts when a flow starts and ends when the flow ends. It is available in sub flows 14
  • 24. References  Web Flow reference  http://static.springframework.org/spring-webflow/docs/2.3.x/reference/html/index.html  samples  https://github.com/spring-projects/spring-webflow-samples  Spring Web Flow 2 Web Development  https://www.safaribooksonline.com/library/view/spring-web-flow/9781847195425/pr01.html  Refcardz  http://refcardz.dzone.com/refcardz/spring-web-flow 24

Editor's Notes

  1. Method Signature ()  Which is empty without arguments because our method in this case (run) does not accept arguments, but in case we implement method that accept arguments we would give here arguments names without types because of course the interface as we said has only one method and they types are already known and lambda target is to eliminate the unnecessary syntax .   The second part is the implementation of the method body