Expert Spring MVC and Web Flow

(Dana P.) #1

Table 12-7.Different States


Name Description


Action state Executes your application code, typically delegating to a business service in the
middle tier.


View state Renders a view allowing the user to participate in the flow by entering data,
viewing a message or making a decision.


Subflow state Spawns another flow as a subflow. The parent flow is suspended until the subflow
reaches an end state, at which point the subflow will end and the parent flow
will resume.


Decision state Evaluates a condition to drive a transition to a new state.


End state Terminates a flow.


Action States


Action states are the primary way to execute your business logic within Spring Web Flow. They
are comprised of actionbeans and transitions, but may also specify actionbeans to be exe-
cuted whenever the state is entered or exited.


Chain of Responsibility


A common requirement is to chain a number of logical actions together, and this is easily
achieved within Spring Web Flow. There are essentially two strategies:


•Create distinct action states for each of the logical steps in the chain, transitioning from
state to state. This provides the most flexibility.

•Invoke multiple actions within a single action state by using named actions. This does
not provide as much flexibility, but it is more concise.

Let’s look at the first case in Listing 12-19, which shows two actions invoked in a chain
using two distinct action states.


Listing 12-19.Chaining Action States














CHAPTER 12 ■ADVANCED SPRING WEB FLOW 359
Free download pdf