Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Spring Web Flow has something called subflow which allows one webflow to invoke another webflow possibly defined in a different module. When designed properly, webflow allows collaboration of disparate modules.

Get started with subflow

...

  1. Define a subflow-state
    Code Block
    xml
    xml
        <!-- id: handle for this subflow.
             subflow: registered webflow name. by convention, spring names webflow by using the XML definition filename minus .xml. -->
        <subflow-state id="questionGroupStep" subflow="questionnaire">
            <transition on="viewClientDetails" to="selectCustomerStep"></transition>
        </subflow-state>
    

    In this example, the subflow is given a name of "questionGroupStep". The subflow will invoke the "questionnaire" webflow. When the subflow exits, it will make a transition to "selectCustomerStep" state.

  2. To invoke the subflow, simply use the subflow's ID as the target of state transition:
    Code Block
    xml
    xml
        <view-state id="customerSearchStep" view="createSavingsAccountCustomerSearch" model="savingsAccountFormBean">
            <transition on="searchTermEntered" to="questionGroupStep" validate="true"></transition>
        </view-state>
    

    In this example, when event "searchTermEntered" is triggered, webflow will make a transition to "questionGroupStep" - our subflow.

...