Expert Spring MVC and Web Flow

(Dana P.) #1

So with knowledge of these basic building blocks in place, the challenge of implementing
a flow definition becomes:


1.defining the states of the flow

2.defining the possible transitions between states and the event-driven criteria for those
state transitions.

Your First Flow


In this section you will implement the example Purchase Product use case using Spring Web
Flow. Chapter 12 will cover many of the decisions that the author has made and reevaluate
some of those decisions regarding how this example works within Spring MVC. This section
will not cover Spring MVC itself, as that is sufficiently covered elsewhere in this book. For now,
let’s assume you have a working Spring MVC project that can be built and deployed onto a
servlet container.


Installing Spring Web Flow


Instructions for downloading and installing Spring Web Flow can be found at http://
opensource2.atlassian.com/confluence/spring/display/WEBFLOW/Home.


Proposed Flow Directory Structure


From our experience it is best to partition your Spring Web Flow configuration information
into file fragments that are responsible for their own concerns. Figure 11-5 is an example of a
prudent directory structure for managing Spring Web Flow configuration artifacts.


Figure 11-5.Suggested directory layout


......

your-domain-servlet.xml flows.xml

Standard Spring
MVC-servlet.xml

Infrastructure common
across *all* Spring Web
Flows
WEB-INF

a-flow.xml

Definition of first
web flow
x-flow.xml

Definition of xth
web flow

a-context.xml

Bean Factory for
first web flow
x-context.xml

BeanFactory for
xth web flow

WEB-INF/flows
......

CHAPTER 11 ■INTRODUCTION TO SPRING WEB FLOW 319
Free download pdf