SlideShare a Scribd company logo
Spring Web Flow
A little flow of happiness.
Presented by – Vikrant
Agenda
 Why Web – Flow ?
 Spring Web-Flow (Basic Introduction)
 Spring Web-Flow Grails Plugin
 Demo
Introduction
Spring Web Flow builds on Spring MVC and allows
implementing the "flows" of a web application. A flow
encapsulates a sequence of steps that guide a user through the
execution of some business task. It spans multiple HTTP
requests, has state, deals with transactional data, is reusable.
Stateful web applications with controlled navigation such as checking
in for a flight, applying for a loan, shopping cart checkout and many
more.
These scenarios have in common is one or more of the following traits:
● There is a clear start and an end point.
● The user must go through a set of screens in a specific order.
● The changes are not finalized until the last step.
● Once complete it shouldn't be possible to repeat a transaction accidentally
Disadvantages of MVC
 Visualizing the flow is very difficult
 Mixed navigation and view
 Overall navigation rules complexity
 All-in-one navigation storage
 Lack of state control/navigation customization
Use Case
Request Diagram
Basic Components
● Flow – A flow defined as a complete life-span of all States transitions.
● States - Within a flow stuff happens. Either the application performs some logic, the
user answers a question or fills out a form, or a decision is made to determine the next
step to take. The points in the flow where these things happen are known as states.
Five different kinds of state: View, Active, Decision, Subflow, and End.
● Transitions - A view state, action state, or subflow state may have any number of
transitions that direct them to other states.
● Flow Data - As a flow progresses, data is either collected, created, or otherwise
manipulated. Depending on the scope of the data, it may be carried around for periods of
time to be processed or evaluated within the flow
● Events – Events are responsible for transition in between states.
Types of State
View States : A view state displays information to a user or obtains user input
using a form. (e.g. JSP.,jsf, gsp etc)
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.
Note :­ Once a flow has ended it can only be resumed from the start state, in this case 
showCart, and not from any other state.
Grails Flow Scopes
Grails flows have five different scopes you can utilize:
● request - Stores an object for the scope of the current request
● flash - Stores the object for the current and next request only
● flow - Stores objects for the scope of the flow, removing them when the flow
reaches an end state
● conversation - Stores objects for the scope of the conversation including the
root flow and nested subflows
● session - Stores objects in the user's session
Events
Exception Handling
● Transition on exception
on(Exception).to('error')
● Custom exception handler
on(MyCustomException).to('error')
Dependencies for Spring/Grails
Spring Maven/Gradle Dependencies
Maven POM
<dependencies>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-webflow</artifactId>
<version>2.4.4.RELEASE</version>
</dependency>
</dependencies>
Gradle
dependencies {
compile 'org.springframework.webflow:spring-webflow:2.4.4.RELEASE'
}
Grails Plugin Installation
plugins{
....
compile ":webflow:2.1.0"
.....
}
Grails Web Flow Plugin
How to define a flow...
class BookController {
def shoppingCartFlow ={ // add flow to action in Controller
state {
}
…
state {
}
...
}
}
Here, Shopping Cart will be considered as a action and will work like a flow.
Note - Views are stored within a directory that matches the name of the flow:
grails-app/views/book/shoppingCart.
URL - localhost:8080/applicationName/book/shoppingCart
Grails Web Flow Plugin
How to define a state...
def shoppingCartFlow ={
showCart {
on("checkout").to "enterPersonalDetails"
on("continueShopping").to "displayCatalogue"
}
…
displayCatalogue {
redirect(controller: "catalogue", action: "show")
}
displayInvoice()
}
Here, “showCart” and “displayCatelog” will be considered as a state
URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
Grails Web Flow Plugin
Action State ...
enterPersonalDetails {
on("submit") {
def p = new Person(params)
flow.person = p
if (!p.validate()) return error()
}.to "enterShipping"
on("return").to "showCart"
}
Here, action{....} state used to perform some action when it enters into the
ShippingNeeded State
URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
enterPersonalDetails {
action { //action State defined and used to
perform stuffs
}
on("submit") .to "enterShipping"
on("return").to "showCart"
}
Grails Web Flow Plugin
Decision State ...
shippingNeeded {
action { //action State defined and used to perform stuffs
if (params.shippingRequired) yes()
else no()
}
on("yes").to "enterShipping"
on("no").to "enterPayment"
}
Here, action{....} state used to perform some action when it enters into the
ShippingNeeded State
URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
Grails Web Flow Plugin
Sub-Flow State ...
def extendedSearchFlow = {
startExtendedSearch {
on("findMore").to "searchMore"
on("searchAgain").to "noResults"
}
searchMore {
Action {
.........
........
}
on("success").to "moreResults"
on("error").to "noResults"
}
moreResults()
noResults()
}
Here, extendedSearchFlow state used as sub-state
extendedSearch {
// Extended search subflow
subflow(controller: "searchExtensions",
action: "extendedSearch")
on("moreResults").to
"displayMoreResults"
on("noResults").to
"displayNoMoreResults"
}
displayMoreResults()
displayNoMoreResults()
Grails Web Flow Plugin
Transition ...
def shoppingCartFlow ={
showCart {
on("checkout").to "enterPersonalDetails" // Transition from one flow to another
on("continueShopping").to "displayCatalogue"
}
…
displayCatalogue {
redirect(controller: "catalogue", action: "show")
}
displayInvoice()
}
Here, On().to() used to transition from one state to another defined in sequence.
URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
Grails Web Flow Plugin
Take a special care...
● Once a flow has ended it can only be resumed from the start state
● Throughout the flow life-cycle each html/grails control name should be unique.
● Maintain JSessionId is maintained throughout the flow execution.
● Spring Security is checked only before entering into a flow not in between the states
of executing flow
● When placing objects in flash, flow or conversation scope they must implement
java.io.Serializable or an exception will be thrown
● built-in error() and success() methods.
● Any Exception class in-heirarchy or CustomException Handler Class used to handle
Exceptions
References
1. https://dzone.com/refcardz/spring-web-flow
2. http://projects.spring.io/spring-webflow/
3. https://grails-plugins.github.io/grails-webflow-plugin/guide/
4. https://grails.org/plugin/webflow
Questions ?
Take a look aside practically
Demo !!
Thank You !!
Ad

More Related Content

What's hot (20)

Servlet Filter
Servlet FilterServlet Filter
Servlet Filter
AshishSingh Bhatia
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
Bethmi Gunasekara
 
RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017
Wanbok Choi
 
Grails Connecting to MySQL
Grails Connecting to MySQLGrails Connecting to MySQL
Grails Connecting to MySQL
ashishkirpan
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
ATG pipelines
ATG pipelinesATG pipelines
ATG pipelines
Kate Semizhon
 
Logging with log4j v1.2
Logging with log4j v1.2Logging with log4j v1.2
Logging with log4j v1.2
Kamal Mettananda
 
Angular Data Binding
Angular Data BindingAngular Data Binding
Angular Data Binding
Jennifer Estrada
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
WebStackAcademy
 
Django
DjangoDjango
Django
Kangjin Jun
 
Bootstrap
BootstrapBootstrap
Bootstrap
Fajar Baskoro
 
Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use cases
Fabio Biondi
 
A Brief Introduction to React.js
A Brief Introduction to React.jsA Brief Introduction to React.js
A Brief Introduction to React.js
Doug Neiner
 
GraphQL
GraphQLGraphQL
GraphQL
Cédric GILLET
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
Coding Academy
 
Learn javascript easy steps
Learn javascript easy stepsLearn javascript easy steps
Learn javascript easy steps
prince Loffar
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
Knoldus Inc.
 
Rapidly Iterating Across Platforms using Server-Driven UI
Rapidly Iterating Across Platforms using Server-Driven UIRapidly Iterating Across Platforms using Server-Driven UI
Rapidly Iterating Across Platforms using Server-Driven UI
Laura Kelly
 
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
Seomgi Han
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP Framework
Bo-Yi Wu
 
RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017
Wanbok Choi
 
Grails Connecting to MySQL
Grails Connecting to MySQLGrails Connecting to MySQL
Grails Connecting to MySQL
ashishkirpan
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
WebStackAcademy
 
Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use cases
Fabio Biondi
 
A Brief Introduction to React.js
A Brief Introduction to React.jsA Brief Introduction to React.js
A Brief Introduction to React.js
Doug Neiner
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
Coding Academy
 
Learn javascript easy steps
Learn javascript easy stepsLearn javascript easy steps
Learn javascript easy steps
prince Loffar
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
Knoldus Inc.
 
Rapidly Iterating Across Platforms using Server-Driven UI
Rapidly Iterating Across Platforms using Server-Driven UIRapidly Iterating Across Platforms using Server-Driven UI
Rapidly Iterating Across Platforms using Server-Driven UI
Laura Kelly
 
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
Seomgi Han
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP Framework
Bo-Yi Wu
 

Viewers also liked (17)

Reactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaReactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJava
NexThoughts Technologies
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
NexThoughts Technologies
 
JFree chart
JFree chartJFree chart
JFree chart
NexThoughts Technologies
 
Hamcrest
HamcrestHamcrest
Hamcrest
NexThoughts Technologies
 
Grails with swagger
Grails with swaggerGrails with swagger
Grails with swagger
NexThoughts Technologies
 
Introduction to gradle
Introduction to gradleIntroduction to gradle
Introduction to gradle
NexThoughts Technologies
 
Introduction to es6
Introduction to es6Introduction to es6
Introduction to es6
NexThoughts Technologies
 
Jsoup
JsoupJsoup
Jsoup
NexThoughts Technologies
 
Jmh
JmhJmh
Jmh
NexThoughts Technologies
 
Introduction to thymeleaf
Introduction to thymeleafIntroduction to thymeleaf
Introduction to thymeleaf
NexThoughts Technologies
 
Progressive Web-App (PWA)
Progressive Web-App (PWA)Progressive Web-App (PWA)
Progressive Web-App (PWA)
NexThoughts Technologies
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
NexThoughts Technologies
 
Actors model in gpars
Actors model in gparsActors model in gpars
Actors model in gpars
NexThoughts Technologies
 
Cosmos DB Service
Cosmos DB ServiceCosmos DB Service
Cosmos DB Service
NexThoughts Technologies
 
Unit test-using-spock in Grails
Unit test-using-spock in GrailsUnit test-using-spock in Grails
Unit test-using-spock in Grails
NexThoughts Technologies
 
Apache tika
Apache tikaApache tika
Apache tika
NexThoughts Technologies
 
Vertx
VertxVertx
Vertx
NexThoughts Technologies
 
Ad

Similar to Spring Web Flow (20)

Spring Web Flow Grail's Plugin
Spring Web Flow Grail's PluginSpring Web Flow Grail's Plugin
Spring Web Flow Grail's Plugin
C-DAC
 
Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.
Alex Tumanoff
 
Silicon Valley Code Camp - JSF Controller for Reusability
Silicon Valley Code Camp - JSF Controller for ReusabilitySilicon Valley Code Camp - JSF Controller for Reusability
Silicon Valley Code Camp - JSF Controller for Reusability
jcruizjdev
 
Introduction to Srping Web Flow
Introduction to Srping Web Flow Introduction to Srping Web Flow
Introduction to Srping Web Flow
Emad Omara
 
Web flowpresentation
Web flowpresentationWeb flowpresentation
Web flowpresentation
Roman Brovko
 
Why ASP.NET Development is Important?
Why ASP.NET Development is Important?Why ASP.NET Development is Important?
Why ASP.NET Development is Important?
Ayesha Khan
 
Asp dot net lifecycle in details
Asp dot net lifecycle in detailsAsp dot net lifecycle in details
Asp dot net lifecycle in details
Ayesha Khan
 
Windows Workflow Foundation
Windows Workflow FoundationWindows Workflow Foundation
Windows Workflow Foundation
Usman Zafar Malik
 
Spring Web Webflow
Spring Web WebflowSpring Web Webflow
Spring Web Webflow
Emprovise
 
Asp.net life cycle in depth
Asp.net life cycle in depthAsp.net life cycle in depth
Asp.net life cycle in depth
sonia merchant
 
Grails services
Grails servicesGrails services
Grails services
Vijay Shukla
 
Discrete event-simulation
Discrete event-simulationDiscrete event-simulation
Discrete event-simulation
PrimeAsia University
 
[@NaukriEngineering] Flux Architecture
[@NaukriEngineering] Flux Architecture[@NaukriEngineering] Flux Architecture
[@NaukriEngineering] Flux Architecture
Naukri.com
 
Unidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in SwiftUnidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in Swift
Seyhun AKYUREK
 
asp-2005311dgvdfvdfvfdfvdvfdbfdb03252 (1).ppt
asp-2005311dgvdfvdfvfdfvdvfdbfdb03252 (1).pptasp-2005311dgvdfvdfvfdfvdvfdbfdb03252 (1).ppt
asp-2005311dgvdfvdfvfdfvdvfdbfdb03252 (1).ppt
Anwar Patel
 
Asp.net control
Asp.net controlAsp.net control
Asp.net control
Paneliya Prince
 
Oracle ADF Task Flows for Beginners
Oracle ADF Task Flows for BeginnersOracle ADF Task Flows for Beginners
Oracle ADF Task Flows for Beginners
DataNext Solutions
 
Transaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in JavaTransaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in Java
Ersen Öztoprak
 
Flux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from FlipkartFlux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from Flipkart
Shyam Kumar Akirala
 
STATE MANAGEMENT IN REACT [Autosaved].pptx
STATE MANAGEMENT IN REACT [Autosaved].pptxSTATE MANAGEMENT IN REACT [Autosaved].pptx
STATE MANAGEMENT IN REACT [Autosaved].pptx
siddheshjadhav919123
 
Spring Web Flow Grail's Plugin
Spring Web Flow Grail's PluginSpring Web Flow Grail's Plugin
Spring Web Flow Grail's Plugin
C-DAC
 
Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.
Alex Tumanoff
 
Silicon Valley Code Camp - JSF Controller for Reusability
Silicon Valley Code Camp - JSF Controller for ReusabilitySilicon Valley Code Camp - JSF Controller for Reusability
Silicon Valley Code Camp - JSF Controller for Reusability
jcruizjdev
 
Introduction to Srping Web Flow
Introduction to Srping Web Flow Introduction to Srping Web Flow
Introduction to Srping Web Flow
Emad Omara
 
Web flowpresentation
Web flowpresentationWeb flowpresentation
Web flowpresentation
Roman Brovko
 
Why ASP.NET Development is Important?
Why ASP.NET Development is Important?Why ASP.NET Development is Important?
Why ASP.NET Development is Important?
Ayesha Khan
 
Asp dot net lifecycle in details
Asp dot net lifecycle in detailsAsp dot net lifecycle in details
Asp dot net lifecycle in details
Ayesha Khan
 
Spring Web Webflow
Spring Web WebflowSpring Web Webflow
Spring Web Webflow
Emprovise
 
Asp.net life cycle in depth
Asp.net life cycle in depthAsp.net life cycle in depth
Asp.net life cycle in depth
sonia merchant
 
[@NaukriEngineering] Flux Architecture
[@NaukriEngineering] Flux Architecture[@NaukriEngineering] Flux Architecture
[@NaukriEngineering] Flux Architecture
Naukri.com
 
Unidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in SwiftUnidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in Swift
Seyhun AKYUREK
 
asp-2005311dgvdfvdfvfdfvdvfdbfdb03252 (1).ppt
asp-2005311dgvdfvdfvfdfvdvfdbfdb03252 (1).pptasp-2005311dgvdfvdfvfdfvdvfdbfdb03252 (1).ppt
asp-2005311dgvdfvdfvfdfvdvfdbfdb03252 (1).ppt
Anwar Patel
 
Oracle ADF Task Flows for Beginners
Oracle ADF Task Flows for BeginnersOracle ADF Task Flows for Beginners
Oracle ADF Task Flows for Beginners
DataNext Solutions
 
Transaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in JavaTransaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in Java
Ersen Öztoprak
 
Flux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from FlipkartFlux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from Flipkart
Shyam Kumar Akirala
 
STATE MANAGEMENT IN REACT [Autosaved].pptx
STATE MANAGEMENT IN REACT [Autosaved].pptxSTATE MANAGEMENT IN REACT [Autosaved].pptx
STATE MANAGEMENT IN REACT [Autosaved].pptx
siddheshjadhav919123
 
Ad

More from NexThoughts Technologies (20)

Alexa skill
Alexa skillAlexa skill
Alexa skill
NexThoughts Technologies
 
GraalVM
GraalVMGraalVM
GraalVM
NexThoughts Technologies
 
Docker & kubernetes
Docker & kubernetesDocker & kubernetes
Docker & kubernetes
NexThoughts Technologies
 
Apache commons
Apache commonsApache commons
Apache commons
NexThoughts Technologies
 
HazelCast
HazelCastHazelCast
HazelCast
NexThoughts Technologies
 
MySQL Pro
MySQL ProMySQL Pro
MySQL Pro
NexThoughts Technologies
 
Microservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & ReduxMicroservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & Redux
NexThoughts Technologies
 
Swagger
SwaggerSwagger
Swagger
NexThoughts Technologies
 
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
NexThoughts Technologies
 
Arango DB
Arango DBArango DB
Arango DB
NexThoughts Technologies
 
Jython
JythonJython
Jython
NexThoughts Technologies
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
NexThoughts Technologies
 
Smart Contract samples
Smart Contract samplesSmart Contract samples
Smart Contract samples
NexThoughts Technologies
 
My Doc of geth
My Doc of gethMy Doc of geth
My Doc of geth
NexThoughts Technologies
 
Geth important commands
Geth important commandsGeth important commands
Geth important commands
NexThoughts Technologies
 
Ethereum genesis
Ethereum genesisEthereum genesis
Ethereum genesis
NexThoughts Technologies
 
Ethereum
EthereumEthereum
Ethereum
NexThoughts Technologies
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
NexThoughts Technologies
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
NexThoughts Technologies
 
Google authentication
Google authenticationGoogle authentication
Google authentication
NexThoughts Technologies
 

Recently uploaded (20)

Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 

Spring Web Flow

  • 2. Agenda  Why Web – Flow ?  Spring Web-Flow (Basic Introduction)  Spring Web-Flow Grails Plugin  Demo
  • 3. Introduction Spring Web Flow builds on Spring MVC and allows implementing the "flows" of a web application. A flow encapsulates a sequence of steps that guide a user through the execution of some business task. It spans multiple HTTP requests, has state, deals with transactional data, is reusable. Stateful web applications with controlled navigation such as checking in for a flight, applying for a loan, shopping cart checkout and many more. These scenarios have in common is one or more of the following traits: ● There is a clear start and an end point. ● The user must go through a set of screens in a specific order. ● The changes are not finalized until the last step. ● Once complete it shouldn't be possible to repeat a transaction accidentally
  • 4. Disadvantages of MVC  Visualizing the flow is very difficult  Mixed navigation and view  Overall navigation rules complexity  All-in-one navigation storage  Lack of state control/navigation customization
  • 7. Basic Components ● Flow – A flow defined as a complete life-span of all States transitions. ● States - Within a flow stuff happens. Either the application performs some logic, the user answers a question or fills out a form, or a decision is made to determine the next step to take. The points in the flow where these things happen are known as states. Five different kinds of state: View, Active, Decision, Subflow, and End. ● Transitions - A view state, action state, or subflow state may have any number of transitions that direct them to other states. ● Flow Data - As a flow progresses, data is either collected, created, or otherwise manipulated. Depending on the scope of the data, it may be carried around for periods of time to be processed or evaluated within the flow ● Events – Events are responsible for transition in between states.
  • 8. Types of State View States : A view state displays information to a user or obtains user input using a form. (e.g. JSP.,jsf, gsp etc) 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. Note :­ Once a flow has ended it can only be resumed from the start state, in this case  showCart, and not from any other state.
  • 9. Grails Flow Scopes Grails flows have five different scopes you can utilize: ● request - Stores an object for the scope of the current request ● flash - Stores the object for the current and next request only ● flow - Stores objects for the scope of the flow, removing them when the flow reaches an end state ● conversation - Stores objects for the scope of the conversation including the root flow and nested subflows ● session - Stores objects in the user's session
  • 11. Exception Handling ● Transition on exception on(Exception).to('error') ● Custom exception handler on(MyCustomException).to('error')
  • 12. Dependencies for Spring/Grails Spring Maven/Gradle Dependencies Maven POM <dependencies> <dependency> <groupId>org.springframework.webflow</groupId> <artifactId>spring-webflow</artifactId> <version>2.4.4.RELEASE</version> </dependency> </dependencies> Gradle dependencies { compile 'org.springframework.webflow:spring-webflow:2.4.4.RELEASE' } Grails Plugin Installation plugins{ .... compile ":webflow:2.1.0" ..... }
  • 13. Grails Web Flow Plugin How to define a flow... class BookController { def shoppingCartFlow ={ // add flow to action in Controller state { } … state { } ... } } Here, Shopping Cart will be considered as a action and will work like a flow. Note - Views are stored within a directory that matches the name of the flow: grails-app/views/book/shoppingCart. URL - localhost:8080/applicationName/book/shoppingCart
  • 14. Grails Web Flow Plugin How to define a state... def shoppingCartFlow ={ showCart { on("checkout").to "enterPersonalDetails" on("continueShopping").to "displayCatalogue" } … displayCatalogue { redirect(controller: "catalogue", action: "show") } displayInvoice() } Here, “showCart” and “displayCatelog” will be considered as a state URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
  • 15. Grails Web Flow Plugin Action State ... enterPersonalDetails { on("submit") { def p = new Person(params) flow.person = p if (!p.validate()) return error() }.to "enterShipping" on("return").to "showCart" } Here, action{....} state used to perform some action when it enters into the ShippingNeeded State URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14 enterPersonalDetails { action { //action State defined and used to perform stuffs } on("submit") .to "enterShipping" on("return").to "showCart" }
  • 16. Grails Web Flow Plugin Decision State ... shippingNeeded { action { //action State defined and used to perform stuffs if (params.shippingRequired) yes() else no() } on("yes").to "enterShipping" on("no").to "enterPayment" } Here, action{....} state used to perform some action when it enters into the ShippingNeeded State URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
  • 17. Grails Web Flow Plugin Sub-Flow State ... def extendedSearchFlow = { startExtendedSearch { on("findMore").to "searchMore" on("searchAgain").to "noResults" } searchMore { Action { ......... ........ } on("success").to "moreResults" on("error").to "noResults" } moreResults() noResults() } Here, extendedSearchFlow state used as sub-state extendedSearch { // Extended search subflow subflow(controller: "searchExtensions", action: "extendedSearch") on("moreResults").to "displayMoreResults" on("noResults").to "displayNoMoreResults" } displayMoreResults() displayNoMoreResults()
  • 18. Grails Web Flow Plugin Transition ... def shoppingCartFlow ={ showCart { on("checkout").to "enterPersonalDetails" // Transition from one flow to another on("continueShopping").to "displayCatalogue" } … displayCatalogue { redirect(controller: "catalogue", action: "show") } displayInvoice() } Here, On().to() used to transition from one state to another defined in sequence. URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
  • 19. Grails Web Flow Plugin Take a special care... ● Once a flow has ended it can only be resumed from the start state ● Throughout the flow life-cycle each html/grails control name should be unique. ● Maintain JSessionId is maintained throughout the flow execution. ● Spring Security is checked only before entering into a flow not in between the states of executing flow ● When placing objects in flash, flow or conversation scope they must implement java.io.Serializable or an exception will be thrown ● built-in error() and success() methods. ● Any Exception class in-heirarchy or CustomException Handler Class used to handle Exceptions
  • 20. References 1. https://dzone.com/refcardz/spring-web-flow 2. http://projects.spring.io/spring-webflow/ 3. https://grails-plugins.github.io/grails-webflow-plugin/guide/ 4. https://grails.org/plugin/webflow
  • 22. Take a look aside practically Demo !!