SlideShare a Scribd company logo
1 of 49
Download to read offline
Stateful Web Application
Development with Spring Web Flow
John Case
Senior Consultant
Centare Group, Ltd.
http://www.centare.com
Centare Group, Ltd
• Centare Group Mission
– Help clients achieve success through the delivery of appropriate
technical solutions
• Specialists in:
– Software application development
– System integration
– Information delivery (business intelligence)
• Strategic Partnerships
– SpringSource, Actuate, Microsoft Gold Certified Partner
About Me
• Senior Consultant with Centare Group
• 7+ years professional Java development
experience
• First used Spring 1.2 in fall of 2005
• First used WebFlow in summer of 2007
• Currently working with Spring 2.5
Agenda
• Stateful web application development
• Model business process as a single unit
• Processes are reusable across different areas
of the application
• Testing
Stateful Web Application
• Most web based applications are stateful
• Any application in which the user enters all
data required for a single business transaction
across multiple pages
– Shopping Cart Checkout
– Booking a flight online
• Partial data from early pages is either stored in
HTTP Session or written to a database
– Explicitly managed by the application
Stateful Web Application Challenges
• HTTP is an inherently stateless protocol
• Each request is an event unto itself
• Traditional Web Frameworks rely on a request
driven approach
– Each page submits to a distinct controller
– Each controller only responsible for a single step
in the overall process
Stateful Web Application Challenges
• Many navigation paths can be difficult to
manage
– No central place to manage all navigation
• Request and Session scopes often not
sufficient
– Client side redirects clear out request scope
– Double post and back button problems
• Difficult to test
Traditional Stateful Web Application
Agenda
• Stateful web application development
• Model business process as a single unit
• Processes are reusable across different areas
of the application
• Testing
Process Driven Application
• Define all navigation in a central location
• Treat the entire interaction as one algorithm
• Let the framework decide what to do and
where to go based on events triggered by the
user
Process Driven Application
Shopping Cart Flow Diagram
High Level Concepts
States
• View State
– Pause execution and render a view to obtain user
input
• Action State
– Execute Java code
– Can transition to different states depending on
outcome
• Decision State
– Branch logic
States
• Subflow State
– Transfer execution to a different flow
– Execution will return to this state when the
subflow has completed
• End State
– Final state of the flow
– May or may not define a view to render
Variables
• WebFlow allows you to define variables as
part of the process model
• Variables can be stored in one of several
different scopes
– Conversation, Flow, Flash, View, Request
Conversation And Flow Scopes
• Conversation scope available to all flows
• Flow scope limited only to a single flow
Flash Scope
• Cleared once a view is rendered
• Useful for temporarily saving results from
action states
• Live through client-side redirects
View Scope
• Created once a view-state is entered
• Destroyed when that view is exited
• Useful on pages that submit many AJAX
requests
Request and Session Scopes
• Standard request scope still available
– Same life span as always
– Does not live across client-side redirects
• Session scope is not easily accessible
– Is larger than conversation scope
– Does not make sense from within WebFlow
– Interact with session via input and output
attributes of the flow
Modeling the Process
• Domain Specific Language (DSL) provided out
of the box
– XML
• It is possible to define a flow programmatically
• Implement FlowAssembler and FlowBuilder to
create your own flow definition language
Packaging
• A flow is a self contained unit
• Flow definition and associated JSP pages
packaged in the same directory
• Flows are registered with the FlowController
by name
Shopping Cart Flow Definition
<flow xmlns=“…”>
<input name="cart“
required="true“
type=“com.mycomp…" />
<decision-state id=“hasItems">
<if test="cart.empty"
then="goShopping“
else="enterAddresses"/>
</decision-state>
Shopping Cart Flow Definition
<view-state id="enterAddresses“ >
<transition
on="next“
to="shipMethod" />
</view-state>
<view-state id="shipMethod">
<transition
on="back“
to="enterAddresses" />
<transition
on="next“
to="calculateTax" />
</view-state>
Shopping Cart Flow Definition
<action-state id="calculateTax">
<evaluate
expression=“basketService.calcTax(cart)" />
<transition to="ccInfo" />
</action-state>
<view-state id="ccInfo">
…
</view-state>
Evaluate
• Primary connection point between WebFlow
and the back end services
• Expression in the evauate tag is Unified EL
– Same expression language as JSP 2.1
– Can directly reference Spring beans by name
– Access to scoped variables
• flashScope.foo
– Expect to see more of this in Core Spring 3.0
Evaluate
• Use in action states
• Use in view states
– on-entry
– on-render
– on-exit
Shopping Cart Flow Definition
<action-state id="validateCC">
<evaluate
expression=“basketService.validateCC(cart)" />
<transition on=“yes" to="confirm" />
<transition on=“no" to="ccInfo" />
</action-state>
Shopping Cart Flow Definition
<action-state id="processOrder">
<evaluate expression=“…”/>
<transition to="thankYou" />
</action-state>
<end-state id="thankYou“ view=“thankYou”>
<output name=“confirmationNumber”
value=“cart.confirmationNumber” />
</end-state>
<end-state id="goShopping"
view="externalRedirect:servletRelative:/home" />
Coding the View
• Standard HTML forms
• Can use Spring MVC form tags
• Variables from all scopes are available to EL
expressions as request scoped variables
• Always POST to the flow controller
– EL Variable: ${flowExecutionURL}
Triggering an Event:
Named Button
Triggering an Event:
Link
Agenda
• Stateful web application development
• Model business process as a single unit
• Processes are reusable across different areas
of the application
• Testing
Subflows
• No different than a flow
• Call a flow from another flow
• Has its own variable namespace
– Flow scope not shared between flows
– Conversation scope is shared between flows
• Analogous to a method call in Java code
Shopping Cart Flow Diagram
Shopping Cart Flow Diagram
High Level Concepts
Subflow Definition
<view-state id="enterAddresses">
<transition on="next" to="shipMethod" />
<transition on="addrBook" to="addrBook" />
</view-state>
<subflow-state id="addrBook“
subflow="addressBookFlow">
<attribute name="user" value="cart.user" />
<transition to=“enterAddresses” />
</subflow-state>
Securing WebFlow
<view-state id="enterAddresses">
<transition on="next" to="shipMethod" />
<transition on="addrBook" to="addrBook" />
</view-state>
<subflow-state id="addrBook“
subflow="addressBookFlow">
<secured attributes="ROLE_AUTHENTICATED" />
<attribute name="user" value="cart.user" />
<transition to=“enterAddresses” />
</subflow-state>
<view-state id="enterAddresses">
<transition on="next" to="shipMethod" />
<transition on="addrBook" to="addrBook" />
</view-state>
<subflow-state id="addrBook“
subflow="addressBookFlow">
<secured attributes=“ROLE_AUTHENTICATED” />
<attribute name="user" value="cart.user" />
<transition to=“enterAddresses” />
</subflow-state>
Securing WebFlow
• Integrates with Spring Security
• <secured> tag can be applied to
– States
– Transitions
– Flows
• AccessDeniedException thrown
– Handled by Spring Security according to its own
configuration
Agenda
• Stateful web application development
• Model business process as a single unit
• Processes are reusable across different areas
of the application
• Testing
Testing WebFlow
• Testing a multi page web process can be very
difficult
– Usually involves setting up a test server and
actually running the application
– Difficult to isolate the process flow definition from
the execution
– Difficult to test middle steps without executing all
previous steps
Testing WebFlow
• WebFlow ships with the
AbstractXmlFlowExecutionTests class
– JUnit test
– All tests run inside of a full Spring container, with all
objects wired up
• At minimum, give it the location of your XML flow
definition
• Provides other useful hooks
– Register stubs and mocks with the Spring container
– Provide path to parent flow definition if necessary
AbstractXmlFlowExecutionTests
• Drive Flow Execution
– startFlow(), setCurrentState(), resumeFlow()
• Assertions
– assertCurrentStateEquals()
– assertFlowExecutionEnded()
– more
• Scoped Variable Access
– Get and set
MockExternalContext
• Use this class to populate whatever external
state you expect for the portion of the flow
under test
– setCurrentUser()
– setEventId()
– getRequestParameterMap().put(“name”, “value”)
Example Test: Making Transitions
public void testSomething() throws Exception {
setCurrentState(“enterAddresses”);
MockExternalContext context =
new MockExternalContext();
context.setEventId(“next”);
resumeFlow(context);
assertCurrentStateEquals(“shipMethod”);
}
Summary
• Stateful web application development
– Process driven approach very different from
request driven approach of traditional MVC
frameworks
• Model business process as a single unit
– WebFlow uses a Domain Specific Language (DSL)
analogous to a flow chart to model the process in
a single file
Summary
• Processes are reusable across different areas of the
application
– Flows can be called by other flows just like a method call in
Java code. Flows can accept input parameters and can
return output values.
• Easily Testable
– AbstractXmlFlowExecutionTests and
MockExecutionContext provide a valuable harness for
testing flow definitions in isolation from application logic.
Thank You!

More Related Content

What's hot

Introduction to Oracle ADF Task Flows
Introduction to Oracle ADF Task FlowsIntroduction to Oracle ADF Task Flows
Introduction to Oracle ADF Task FlowsRohan Walia
 
Spring Web Flow Grail's Plugin
Spring Web Flow Grail's PluginSpring Web Flow Grail's Plugin
Spring Web Flow Grail's PluginC-DAC
 
Integrity of data lucas jellema
Integrity of data   lucas jellemaIntegrity of data   lucas jellema
Integrity of data lucas jellemaNLJUG
 
Improving end user experience using ManageEngine Applications Manager
Improving end user experience using ManageEngine Applications ManagerImproving end user experience using ManageEngine Applications Manager
Improving end user experience using ManageEngine Applications ManagerManageEngine, Zoho Corporation
 
Business Process Management using BPEL
Business Process Management using BPELBusiness Process Management using BPEL
Business Process Management using BPELThanachart Numnonda
 
jBPM Overview & Alfresco Workflows
jBPM Overview &  Alfresco WorkflowsjBPM Overview &  Alfresco Workflows
jBPM Overview & Alfresco WorkflowsFrancesco Valente
 
Testing web services
Testing web servicesTesting web services
Testing web servicesTaras Lytvyn
 
Dont Reinvent the Wheel: Tips and Tricks for reuse in ADF
Dont Reinvent the Wheel: Tips and Tricks for reuse in ADFDont Reinvent the Wheel: Tips and Tricks for reuse in ADF
Dont Reinvent the Wheel: Tips and Tricks for reuse in ADFLuc Bors
 
Soa 11 representational state transfer rest
Soa 11 representational state transfer restSoa 11 representational state transfer rest
Soa 11 representational state transfer restVaibhav Khanna
 
Customizations in Enterprise Applications using Oracle ADF
Customizations in Enterprise Applications using Oracle ADFCustomizations in Enterprise Applications using Oracle ADF
Customizations in Enterprise Applications using Oracle ADFRohan Walia
 
Tutorial: Writing Sencha Touch Mobile Apps using ]project-open[
Tutorial: Writing Sencha Touch Mobile Apps using ]project-open[Tutorial: Writing Sencha Touch Mobile Apps using ]project-open[
Tutorial: Writing Sencha Touch Mobile Apps using ]project-open[Klaus Hofeditz
 
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-RSFahad Golra
 
Enterprise java unit-1_chapter-1
Enterprise java unit-1_chapter-1Enterprise java unit-1_chapter-1
Enterprise java unit-1_chapter-1sandeep54552
 
Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5PawanMM
 
Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Ido Flatow
 
Session 30 - Servlets - Part 6
Session 30 - Servlets - Part 6Session 30 - Servlets - Part 6
Session 30 - Servlets - Part 6PawanMM
 
Eclipse Developement @ Progress Software
Eclipse Developement @ Progress SoftwareEclipse Developement @ Progress Software
Eclipse Developement @ Progress Softwaresriikanthp
 

What's hot (20)

Introduction to Oracle ADF Task Flows
Introduction to Oracle ADF Task FlowsIntroduction to Oracle ADF Task Flows
Introduction to Oracle ADF Task Flows
 
Spring Web Flow Grail's Plugin
Spring Web Flow Grail's PluginSpring Web Flow Grail's Plugin
Spring Web Flow Grail's Plugin
 
Integrity of data lucas jellema
Integrity of data   lucas jellemaIntegrity of data   lucas jellema
Integrity of data lucas jellema
 
Improving end user experience using ManageEngine Applications Manager
Improving end user experience using ManageEngine Applications ManagerImproving end user experience using ManageEngine Applications Manager
Improving end user experience using ManageEngine Applications Manager
 
Business Process Management using BPEL
Business Process Management using BPELBusiness Process Management using BPEL
Business Process Management using BPEL
 
jBPM Overview & Alfresco Workflows
jBPM Overview &  Alfresco WorkflowsjBPM Overview &  Alfresco Workflows
jBPM Overview & Alfresco Workflows
 
Testing web services
Testing web servicesTesting web services
Testing web services
 
Dont Reinvent the Wheel: Tips and Tricks for reuse in ADF
Dont Reinvent the Wheel: Tips and Tricks for reuse in ADFDont Reinvent the Wheel: Tips and Tricks for reuse in ADF
Dont Reinvent the Wheel: Tips and Tricks for reuse in ADF
 
Soa 11 representational state transfer rest
Soa 11 representational state transfer restSoa 11 representational state transfer rest
Soa 11 representational state transfer rest
 
Customizations in Enterprise Applications using Oracle ADF
Customizations in Enterprise Applications using Oracle ADFCustomizations in Enterprise Applications using Oracle ADF
Customizations in Enterprise Applications using Oracle ADF
 
Weblogic - Data management in application servers
Weblogic - Data management in application serversWeblogic - Data management in application servers
Weblogic - Data management in application servers
 
Tutorial: Writing Sencha Touch Mobile Apps using ]project-open[
Tutorial: Writing Sencha Touch Mobile Apps using ]project-open[Tutorial: Writing Sencha Touch Mobile Apps using ]project-open[
Tutorial: Writing Sencha Touch Mobile Apps using ]project-open[
 
An Oracle ADF Introduction
An Oracle ADF IntroductionAn Oracle ADF Introduction
An Oracle ADF Introduction
 
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
 
Enterprise java unit-1_chapter-1
Enterprise java unit-1_chapter-1Enterprise java unit-1_chapter-1
Enterprise java unit-1_chapter-1
 
Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5Session 29 - Servlets - Part 5
Session 29 - Servlets - Part 5
 
Web Services
Web ServicesWeb Services
Web Services
 
Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6
 
Session 30 - Servlets - Part 6
Session 30 - Servlets - Part 6Session 30 - Servlets - Part 6
Session 30 - Servlets - Part 6
 
Eclipse Developement @ Progress Software
Eclipse Developement @ Progress SoftwareEclipse Developement @ Progress Software
Eclipse Developement @ Progress Software
 

Viewers also liked

68 - Spring. Функционал
68 - Spring. Функционал68 - Spring. Функционал
68 - Spring. ФункционалRoman Brovko
 
78 - Spring. Настройка GlassFish
78 - Spring. Настройка GlassFish78 - Spring. Настройка GlassFish
78 - Spring. Настройка GlassFishRoman Brovko
 
70 - Spring. Установка GlassFish
70 - Spring. Установка GlassFish70 - Spring. Установка GlassFish
70 - Spring. Установка GlassFishRoman Brovko
 
2013 02 28_bigdata_seminare_02
2013 02 28_bigdata_seminare_022013 02 28_bigdata_seminare_02
2013 02 28_bigdata_seminare_02Roman Brovko
 
72 - Spring. Создание абстрактного уровня
72 - Spring. Создание абстрактного уровня72 - Spring. Создание абстрактного уровня
72 - Spring. Создание абстрактного уровняRoman Brovko
 
2013 03 21_bigdata_seminar_05
2013 03 21_bigdata_seminar_052013 03 21_bigdata_seminar_05
2013 03 21_bigdata_seminar_05Roman Brovko
 
72 - Spring. Создание абстрактного уровня. Разбор д/з
72 - Spring. Создание абстрактного уровня. Разбор д/з72 - Spring. Создание абстрактного уровня. Разбор д/з
72 - Spring. Создание абстрактного уровня. Разбор д/зRoman Brovko
 
67 - Spring. Начальные знания
67 - Spring. Начальные знания67 - Spring. Начальные знания
67 - Spring. Начальные знанияRoman Brovko
 
144 - Spring. Наследование потоков
144 - Spring. Наследование потоков144 - Spring. Наследование потоков
144 - Spring. Наследование потоковRoman Brovko
 
143 - Spring. JSF centric integration
143 - Spring. JSF centric integration143 - Spring. JSF centric integration
143 - Spring. JSF centric integrationRoman Brovko
 
17 - Web-технологии. Real Time сообщения
17 - Web-технологии. Real Time сообщения17 - Web-технологии. Real Time сообщения
17 - Web-технологии. Real Time сообщенияRoman Brovko
 
Лекция 12. Быстрее, Python, ещё быстрее.
Лекция 12. Быстрее, Python, ещё быстрее.Лекция 12. Быстрее, Python, ещё быстрее.
Лекция 12. Быстрее, Python, ещё быстрее.Roman Brovko
 
Лекция 5. Встроенные коллекции и модуль collections.
Лекция 5. Встроенные коллекции и модуль collections.Лекция 5. Встроенные коллекции и модуль collections.
Лекция 5. Встроенные коллекции и модуль collections.Roman Brovko
 
Лекция 6. Классы 1.
Лекция 6. Классы 1.Лекция 6. Классы 1.
Лекция 6. Классы 1.Roman Brovko
 
Лекция 10. Классы 2.
Лекция 10. Классы 2.Лекция 10. Классы 2.
Лекция 10. Классы 2.Roman Brovko
 
Лекция 4. Строки, байты, файлы и ввод/вывод.
 Лекция 4. Строки, байты, файлы и ввод/вывод. Лекция 4. Строки, байты, файлы и ввод/вывод.
Лекция 4. Строки, байты, файлы и ввод/вывод.Roman Brovko
 
Лекция 8. Итераторы, генераторы и модуль itertools.
 Лекция 8. Итераторы, генераторы и модуль itertools. Лекция 8. Итераторы, генераторы и модуль itertools.
Лекция 8. Итераторы, генераторы и модуль itertools.Roman Brovko
 
Лекция 3. Декораторы и модуль functools.
Лекция 3. Декораторы и модуль functools.Лекция 3. Декораторы и модуль functools.
Лекция 3. Декораторы и модуль functools.Roman Brovko
 
Лекция 13. Многопоточность и GIL
Лекция 13. Многопоточность и GILЛекция 13. Многопоточность и GIL
Лекция 13. Многопоточность и GILRoman Brovko
 
Лекция 2. Всё, что вы хотели знать о функциях в Python.
Лекция 2. Всё, что вы хотели знать о функциях в Python.Лекция 2. Всё, что вы хотели знать о функциях в Python.
Лекция 2. Всё, что вы хотели знать о функциях в Python.Roman Brovko
 

Viewers also liked (20)

68 - Spring. Функционал
68 - Spring. Функционал68 - Spring. Функционал
68 - Spring. Функционал
 
78 - Spring. Настройка GlassFish
78 - Spring. Настройка GlassFish78 - Spring. Настройка GlassFish
78 - Spring. Настройка GlassFish
 
70 - Spring. Установка GlassFish
70 - Spring. Установка GlassFish70 - Spring. Установка GlassFish
70 - Spring. Установка GlassFish
 
2013 02 28_bigdata_seminare_02
2013 02 28_bigdata_seminare_022013 02 28_bigdata_seminare_02
2013 02 28_bigdata_seminare_02
 
72 - Spring. Создание абстрактного уровня
72 - Spring. Создание абстрактного уровня72 - Spring. Создание абстрактного уровня
72 - Spring. Создание абстрактного уровня
 
2013 03 21_bigdata_seminar_05
2013 03 21_bigdata_seminar_052013 03 21_bigdata_seminar_05
2013 03 21_bigdata_seminar_05
 
72 - Spring. Создание абстрактного уровня. Разбор д/з
72 - Spring. Создание абстрактного уровня. Разбор д/з72 - Spring. Создание абстрактного уровня. Разбор д/з
72 - Spring. Создание абстрактного уровня. Разбор д/з
 
67 - Spring. Начальные знания
67 - Spring. Начальные знания67 - Spring. Начальные знания
67 - Spring. Начальные знания
 
144 - Spring. Наследование потоков
144 - Spring. Наследование потоков144 - Spring. Наследование потоков
144 - Spring. Наследование потоков
 
143 - Spring. JSF centric integration
143 - Spring. JSF centric integration143 - Spring. JSF centric integration
143 - Spring. JSF centric integration
 
17 - Web-технологии. Real Time сообщения
17 - Web-технологии. Real Time сообщения17 - Web-технологии. Real Time сообщения
17 - Web-технологии. Real Time сообщения
 
Лекция 12. Быстрее, Python, ещё быстрее.
Лекция 12. Быстрее, Python, ещё быстрее.Лекция 12. Быстрее, Python, ещё быстрее.
Лекция 12. Быстрее, Python, ещё быстрее.
 
Лекция 5. Встроенные коллекции и модуль collections.
Лекция 5. Встроенные коллекции и модуль collections.Лекция 5. Встроенные коллекции и модуль collections.
Лекция 5. Встроенные коллекции и модуль collections.
 
Лекция 6. Классы 1.
Лекция 6. Классы 1.Лекция 6. Классы 1.
Лекция 6. Классы 1.
 
Лекция 10. Классы 2.
Лекция 10. Классы 2.Лекция 10. Классы 2.
Лекция 10. Классы 2.
 
Лекция 4. Строки, байты, файлы и ввод/вывод.
 Лекция 4. Строки, байты, файлы и ввод/вывод. Лекция 4. Строки, байты, файлы и ввод/вывод.
Лекция 4. Строки, байты, файлы и ввод/вывод.
 
Лекция 8. Итераторы, генераторы и модуль itertools.
 Лекция 8. Итераторы, генераторы и модуль itertools. Лекция 8. Итераторы, генераторы и модуль itertools.
Лекция 8. Итераторы, генераторы и модуль itertools.
 
Лекция 3. Декораторы и модуль functools.
Лекция 3. Декораторы и модуль functools.Лекция 3. Декораторы и модуль functools.
Лекция 3. Декораторы и модуль functools.
 
Лекция 13. Многопоточность и GIL
Лекция 13. Многопоточность и GILЛекция 13. Многопоточность и GIL
Лекция 13. Многопоточность и GIL
 
Лекция 2. Всё, что вы хотели знать о функциях в Python.
Лекция 2. Всё, что вы хотели знать о функциях в Python.Лекция 2. Всё, что вы хотели знать о функциях в Python.
Лекция 2. Всё, что вы хотели знать о функциях в Python.
 

Similar to Web flowpresentation

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
 
Introduction to SoapUI day 1
Introduction to SoapUI day 1Introduction to SoapUI day 1
Introduction to SoapUI day 1Qualitest
 
Soap UI - Getting started
Soap UI - Getting startedSoap UI - Getting started
Soap UI - Getting startedQualitest
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postvamsitricks
 
Java EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJava EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJosh Juneau
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postvamsi krishna
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postvamsitricks
 
Dotnet- An overview of ASP.NET & ADO.NET- Mazenet solution
Dotnet- An overview of ASP.NET & ADO.NET- Mazenet solutionDotnet- An overview of ASP.NET & ADO.NET- Mazenet solution
Dotnet- An overview of ASP.NET & ADO.NET- Mazenet solutionMazenetsolution
 
Real World Event Sourcing and CQRS
Real World Event Sourcing and CQRSReal World Event Sourcing and CQRS
Real World Event Sourcing and CQRSMatthew Hawkins
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Jeremy Likness
 
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database ConnectivityIT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database Connectivitypkaviya
 
Process Orchestration with Flowable and Spring Boot
Process Orchestration with Flowable and Spring BootProcess Orchestration with Flowable and Spring Boot
Process Orchestration with Flowable and Spring BootChavdar Baikov
 
Webservices Workshop - september 2014
Webservices Workshop -  september 2014Webservices Workshop -  september 2014
Webservices Workshop - september 2014clairvoyantllc
 
Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Mayank Srivastava
 
API-Testing-SOAPUI-1.pptx
API-Testing-SOAPUI-1.pptxAPI-Testing-SOAPUI-1.pptx
API-Testing-SOAPUI-1.pptxamarnathdeo
 
Java Web services
Java Web servicesJava Web services
Java Web servicesvpulec
 
Struts2-Spring=Hibernate
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=HibernateJay Shah
 
MVC 1.0 als alternative Webtechnologie
MVC 1.0 als alternative WebtechnologieMVC 1.0 als alternative Webtechnologie
MVC 1.0 als alternative WebtechnologieOPEN KNOWLEDGE GmbH
 

Similar to Web flowpresentation (20)

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.
 
Angular js 1.0-fundamentals
Angular js 1.0-fundamentalsAngular js 1.0-fundamentals
Angular js 1.0-fundamentals
 
Introduction to SoapUI day 1
Introduction to SoapUI day 1Introduction to SoapUI day 1
Introduction to SoapUI day 1
 
Soap UI - Getting started
Soap UI - Getting startedSoap UI - Getting started
Soap UI - Getting started
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
 
Java EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJava EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVC
 
Introduction to Angular JS
Introduction to Angular JSIntroduction to Angular JS
Introduction to Angular JS
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
 
Dotnet- An overview of ASP.NET & ADO.NET- Mazenet solution
Dotnet- An overview of ASP.NET & ADO.NET- Mazenet solutionDotnet- An overview of ASP.NET & ADO.NET- Mazenet solution
Dotnet- An overview of ASP.NET & ADO.NET- Mazenet solution
 
Real World Event Sourcing and CQRS
Real World Event Sourcing and CQRSReal World Event Sourcing and CQRS
Real World Event Sourcing and CQRS
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!
 
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database ConnectivityIT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
 
Process Orchestration with Flowable and Spring Boot
Process Orchestration with Flowable and Spring BootProcess Orchestration with Flowable and Spring Boot
Process Orchestration with Flowable and Spring Boot
 
Webservices Workshop - september 2014
Webservices Workshop -  september 2014Webservices Workshop -  september 2014
Webservices Workshop - september 2014
 
Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0
 
API-Testing-SOAPUI-1.pptx
API-Testing-SOAPUI-1.pptxAPI-Testing-SOAPUI-1.pptx
API-Testing-SOAPUI-1.pptx
 
Java Web services
Java Web servicesJava Web services
Java Web services
 
Struts2-Spring=Hibernate
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=Hibernate
 
MVC 1.0 als alternative Webtechnologie
MVC 1.0 als alternative WebtechnologieMVC 1.0 als alternative Webtechnologie
MVC 1.0 als alternative Webtechnologie
 

More from Roman Brovko

Individual task Networking
Individual task NetworkingIndividual task Networking
Individual task NetworkingRoman Brovko
 
Networking essentials lect3
Networking essentials lect3Networking essentials lect3
Networking essentials lect3Roman Brovko
 
Gl embedded starterkit_ethernet
Gl embedded starterkit_ethernetGl embedded starterkit_ethernet
Gl embedded starterkit_ethernetRoman Brovko
 
Networking essentials lect2
Networking essentials lect2Networking essentials lect2
Networking essentials lect2Roman Brovko
 
Networking essentials lect1
Networking essentials lect1Networking essentials lect1
Networking essentials lect1Roman Brovko
 
Bare metal training_07_spi_flash
Bare metal training_07_spi_flashBare metal training_07_spi_flash
Bare metal training_07_spi_flashRoman Brovko
 
Bare metal training_06_I2C
Bare metal training_06_I2CBare metal training_06_I2C
Bare metal training_06_I2CRoman Brovko
 
Bare metal training_05_uart
Bare metal training_05_uartBare metal training_05_uart
Bare metal training_05_uartRoman Brovko
 
Bare metal training_04_adc_temp_sensor
Bare metal training_04_adc_temp_sensorBare metal training_04_adc_temp_sensor
Bare metal training_04_adc_temp_sensorRoman Brovko
 
Bare metal training_03_timers_pwm
Bare metal training_03_timers_pwmBare metal training_03_timers_pwm
Bare metal training_03_timers_pwmRoman Brovko
 
Bare metal training_02_le_ds_and_buttons
Bare metal training_02_le_ds_and_buttonsBare metal training_02_le_ds_and_buttons
Bare metal training_02_le_ds_and_buttonsRoman Brovko
 
Bare metal training_01_hello_world
Bare metal training_01_hello_worldBare metal training_01_hello_world
Bare metal training_01_hello_worldRoman Brovko
 
Bare metal training_00_prerequisites
Bare metal training_00_prerequisitesBare metal training_00_prerequisites
Bare metal training_00_prerequisitesRoman Brovko
 
C language lect_23_advanced
C language lect_23_advancedC language lect_23_advanced
C language lect_23_advancedRoman Brovko
 
C language lect_22_advanced
C language lect_22_advancedC language lect_22_advanced
C language lect_22_advancedRoman Brovko
 
C language lect_21_advanced
C language lect_21_advancedC language lect_21_advanced
C language lect_21_advancedRoman Brovko
 
подготовка рабочего окружения
подготовка рабочего окруженияподготовка рабочего окружения
подготовка рабочего окруженияRoman Brovko
 
C language lect_20_advanced
C language lect_20_advancedC language lect_20_advanced
C language lect_20_advancedRoman Brovko
 
C language lect_19_basics
C language lect_19_basicsC language lect_19_basics
C language lect_19_basicsRoman Brovko
 

More from Roman Brovko (20)

Individual task Networking
Individual task NetworkingIndividual task Networking
Individual task Networking
 
Networking essentials lect3
Networking essentials lect3Networking essentials lect3
Networking essentials lect3
 
Gl embedded starterkit_ethernet
Gl embedded starterkit_ethernetGl embedded starterkit_ethernet
Gl embedded starterkit_ethernet
 
Networking essentials lect2
Networking essentials lect2Networking essentials lect2
Networking essentials lect2
 
Networking essentials lect1
Networking essentials lect1Networking essentials lect1
Networking essentials lect1
 
Bare metal training_07_spi_flash
Bare metal training_07_spi_flashBare metal training_07_spi_flash
Bare metal training_07_spi_flash
 
Bare metal training_06_I2C
Bare metal training_06_I2CBare metal training_06_I2C
Bare metal training_06_I2C
 
Glesk worshop
Glesk worshopGlesk worshop
Glesk worshop
 
Bare metal training_05_uart
Bare metal training_05_uartBare metal training_05_uart
Bare metal training_05_uart
 
Bare metal training_04_adc_temp_sensor
Bare metal training_04_adc_temp_sensorBare metal training_04_adc_temp_sensor
Bare metal training_04_adc_temp_sensor
 
Bare metal training_03_timers_pwm
Bare metal training_03_timers_pwmBare metal training_03_timers_pwm
Bare metal training_03_timers_pwm
 
Bare metal training_02_le_ds_and_buttons
Bare metal training_02_le_ds_and_buttonsBare metal training_02_le_ds_and_buttons
Bare metal training_02_le_ds_and_buttons
 
Bare metal training_01_hello_world
Bare metal training_01_hello_worldBare metal training_01_hello_world
Bare metal training_01_hello_world
 
Bare metal training_00_prerequisites
Bare metal training_00_prerequisitesBare metal training_00_prerequisites
Bare metal training_00_prerequisites
 
C language lect_23_advanced
C language lect_23_advancedC language lect_23_advanced
C language lect_23_advanced
 
C language lect_22_advanced
C language lect_22_advancedC language lect_22_advanced
C language lect_22_advanced
 
C language lect_21_advanced
C language lect_21_advancedC language lect_21_advanced
C language lect_21_advanced
 
подготовка рабочего окружения
подготовка рабочего окруженияподготовка рабочего окружения
подготовка рабочего окружения
 
C language lect_20_advanced
C language lect_20_advancedC language lect_20_advanced
C language lect_20_advanced
 
C language lect_19_basics
C language lect_19_basicsC language lect_19_basics
C language lect_19_basics
 

Recently uploaded

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

Web flowpresentation

  • 1. Stateful Web Application Development with Spring Web Flow John Case Senior Consultant Centare Group, Ltd. http://www.centare.com
  • 2. Centare Group, Ltd • Centare Group Mission – Help clients achieve success through the delivery of appropriate technical solutions • Specialists in: – Software application development – System integration – Information delivery (business intelligence) • Strategic Partnerships – SpringSource, Actuate, Microsoft Gold Certified Partner
  • 3. About Me • Senior Consultant with Centare Group • 7+ years professional Java development experience • First used Spring 1.2 in fall of 2005 • First used WebFlow in summer of 2007 • Currently working with Spring 2.5
  • 4. Agenda • Stateful web application development • Model business process as a single unit • Processes are reusable across different areas of the application • Testing
  • 5. Stateful Web Application • Most web based applications are stateful • Any application in which the user enters all data required for a single business transaction across multiple pages – Shopping Cart Checkout – Booking a flight online • Partial data from early pages is either stored in HTTP Session or written to a database – Explicitly managed by the application
  • 6. Stateful Web Application Challenges • HTTP is an inherently stateless protocol • Each request is an event unto itself • Traditional Web Frameworks rely on a request driven approach – Each page submits to a distinct controller – Each controller only responsible for a single step in the overall process
  • 7. Stateful Web Application Challenges • Many navigation paths can be difficult to manage – No central place to manage all navigation • Request and Session scopes often not sufficient – Client side redirects clear out request scope – Double post and back button problems • Difficult to test
  • 9. Agenda • Stateful web application development • Model business process as a single unit • Processes are reusable across different areas of the application • Testing
  • 10. Process Driven Application • Define all navigation in a central location • Treat the entire interaction as one algorithm • Let the framework decide what to do and where to go based on events triggered by the user
  • 14. States • View State – Pause execution and render a view to obtain user input • Action State – Execute Java code – Can transition to different states depending on outcome • Decision State – Branch logic
  • 15. States • Subflow State – Transfer execution to a different flow – Execution will return to this state when the subflow has completed • End State – Final state of the flow – May or may not define a view to render
  • 16. Variables • WebFlow allows you to define variables as part of the process model • Variables can be stored in one of several different scopes – Conversation, Flow, Flash, View, Request
  • 17. Conversation And Flow Scopes • Conversation scope available to all flows • Flow scope limited only to a single flow
  • 18. Flash Scope • Cleared once a view is rendered • Useful for temporarily saving results from action states • Live through client-side redirects
  • 19. View Scope • Created once a view-state is entered • Destroyed when that view is exited • Useful on pages that submit many AJAX requests
  • 20. Request and Session Scopes • Standard request scope still available – Same life span as always – Does not live across client-side redirects • Session scope is not easily accessible – Is larger than conversation scope – Does not make sense from within WebFlow – Interact with session via input and output attributes of the flow
  • 21. Modeling the Process • Domain Specific Language (DSL) provided out of the box – XML • It is possible to define a flow programmatically • Implement FlowAssembler and FlowBuilder to create your own flow definition language
  • 22. Packaging • A flow is a self contained unit • Flow definition and associated JSP pages packaged in the same directory • Flows are registered with the FlowController by name
  • 23. Shopping Cart Flow Definition <flow xmlns=“…”> <input name="cart“ required="true“ type=“com.mycomp…" /> <decision-state id=“hasItems"> <if test="cart.empty" then="goShopping“ else="enterAddresses"/> </decision-state>
  • 24. Shopping Cart Flow Definition <view-state id="enterAddresses“ > <transition on="next“ to="shipMethod" /> </view-state> <view-state id="shipMethod"> <transition on="back“ to="enterAddresses" /> <transition on="next“ to="calculateTax" /> </view-state>
  • 25. Shopping Cart Flow Definition <action-state id="calculateTax"> <evaluate expression=“basketService.calcTax(cart)" /> <transition to="ccInfo" /> </action-state> <view-state id="ccInfo"> … </view-state>
  • 26. Evaluate • Primary connection point between WebFlow and the back end services • Expression in the evauate tag is Unified EL – Same expression language as JSP 2.1 – Can directly reference Spring beans by name – Access to scoped variables • flashScope.foo – Expect to see more of this in Core Spring 3.0
  • 27. Evaluate • Use in action states • Use in view states – on-entry – on-render – on-exit
  • 28. Shopping Cart Flow Definition <action-state id="validateCC"> <evaluate expression=“basketService.validateCC(cart)" /> <transition on=“yes" to="confirm" /> <transition on=“no" to="ccInfo" /> </action-state>
  • 29. Shopping Cart Flow Definition <action-state id="processOrder"> <evaluate expression=“…”/> <transition to="thankYou" /> </action-state> <end-state id="thankYou“ view=“thankYou”> <output name=“confirmationNumber” value=“cart.confirmationNumber” /> </end-state> <end-state id="goShopping" view="externalRedirect:servletRelative:/home" />
  • 30. Coding the View • Standard HTML forms • Can use Spring MVC form tags • Variables from all scopes are available to EL expressions as request scoped variables • Always POST to the flow controller – EL Variable: ${flowExecutionURL}
  • 33. Agenda • Stateful web application development • Model business process as a single unit • Processes are reusable across different areas of the application • Testing
  • 34. Subflows • No different than a flow • Call a flow from another flow • Has its own variable namespace – Flow scope not shared between flows – Conversation scope is shared between flows • Analogous to a method call in Java code
  • 38. Subflow Definition <view-state id="enterAddresses"> <transition on="next" to="shipMethod" /> <transition on="addrBook" to="addrBook" /> </view-state> <subflow-state id="addrBook“ subflow="addressBookFlow"> <attribute name="user" value="cart.user" /> <transition to=“enterAddresses” /> </subflow-state>
  • 39. Securing WebFlow <view-state id="enterAddresses"> <transition on="next" to="shipMethod" /> <transition on="addrBook" to="addrBook" /> </view-state> <subflow-state id="addrBook“ subflow="addressBookFlow"> <secured attributes="ROLE_AUTHENTICATED" /> <attribute name="user" value="cart.user" /> <transition to=“enterAddresses” /> </subflow-state> <view-state id="enterAddresses"> <transition on="next" to="shipMethod" /> <transition on="addrBook" to="addrBook" /> </view-state> <subflow-state id="addrBook“ subflow="addressBookFlow"> <secured attributes=“ROLE_AUTHENTICATED” /> <attribute name="user" value="cart.user" /> <transition to=“enterAddresses” /> </subflow-state>
  • 40. Securing WebFlow • Integrates with Spring Security • <secured> tag can be applied to – States – Transitions – Flows • AccessDeniedException thrown – Handled by Spring Security according to its own configuration
  • 41. Agenda • Stateful web application development • Model business process as a single unit • Processes are reusable across different areas of the application • Testing
  • 42. Testing WebFlow • Testing a multi page web process can be very difficult – Usually involves setting up a test server and actually running the application – Difficult to isolate the process flow definition from the execution – Difficult to test middle steps without executing all previous steps
  • 43. Testing WebFlow • WebFlow ships with the AbstractXmlFlowExecutionTests class – JUnit test – All tests run inside of a full Spring container, with all objects wired up • At minimum, give it the location of your XML flow definition • Provides other useful hooks – Register stubs and mocks with the Spring container – Provide path to parent flow definition if necessary
  • 44. AbstractXmlFlowExecutionTests • Drive Flow Execution – startFlow(), setCurrentState(), resumeFlow() • Assertions – assertCurrentStateEquals() – assertFlowExecutionEnded() – more • Scoped Variable Access – Get and set
  • 45. MockExternalContext • Use this class to populate whatever external state you expect for the portion of the flow under test – setCurrentUser() – setEventId() – getRequestParameterMap().put(“name”, “value”)
  • 46. Example Test: Making Transitions public void testSomething() throws Exception { setCurrentState(“enterAddresses”); MockExternalContext context = new MockExternalContext(); context.setEventId(“next”); resumeFlow(context); assertCurrentStateEquals(“shipMethod”); }
  • 47. Summary • Stateful web application development – Process driven approach very different from request driven approach of traditional MVC frameworks • Model business process as a single unit – WebFlow uses a Domain Specific Language (DSL) analogous to a flow chart to model the process in a single file
  • 48. Summary • Processes are reusable across different areas of the application – Flows can be called by other flows just like a method call in Java code. Flows can accept input parameters and can return output values. • Easily Testable – AbstractXmlFlowExecutionTests and MockExecutionContext provide a valuable harness for testing flow definitions in isolation from application logic.