Expert Spring MVC and Web Flow

(Dana P.) #1








■Tip Remember, by default the name of the flow is derived from the name of the file it is defined in.
Because the file is /WEB-INF/flows/shipping-flow.xml,the name (by default) is shipping-flow.


The subflow state defines a number of instructions including


  • the flow to spawn as a subflow(shipping-flow);


•a set of attribute mappings (explained in the following section);


  • one or more transitions eligible for execution when the subflow ends.


When calling a subflow a transition is typically defined for every end state within the
subflow. When the subflow reaches an end state, the subflow will end, and control will return
back to the subflow state in the calling flow. If the subflow state does not contain a transition
matching the ending result of the subflow, a NoMatchingTransitionExceptionwill be thrown.


Attribute Mappings


A new element has been introduced within the element: .
The element, covered in the following section, plays a significant role
when calling subflows, providing the integration between a parent flow and a child flow.
Subflows acting as self-contained black boxes are a very powerful concept, but are some-
what limited if there is no communication at all between the calling flow and the subflow. This
is where AttributeMappers come in. Remember, subflows are independent of the parent flow
and do not share the parent flow’s context. Any information the parent needs to pass into the
subflow, or the subflow needs to return back to the parent, must be explicitly mapped.


■NoteTheattribute-mapperfragment from Listing 12-7 contains both an input-mappingand
an output-mapping; however,input-mapping,output-mapping,and even attribute-mapperare
not required.


CHAPTER 12 ■ADVANCED SPRING WEB FLOW 341
Free download pdf