Spring Webflow 2.0 - communicate to another flow
-
27-09-2019 - |
Question
I have a cancel button which should bring the user back to the start page. The Cancel button is in a flow createXYZ.xml the start page is a view-state in the flow start.xml how can I link from one flow to another.
Start:
<view-state id="start" view="start">
</view-state>
Cancel Button:
<view-state id="createXYZ" view="createXYZ">
<transition on="cancel" to=" ? ">
</transition>
</view-state>
Solution
A subflow state is useful when you have a situation where you want to continue your main flow, but want some added functionality. You would invoke the subflow, do some work, then exit out and return back to the original flow.
I am not sure if that is what you are trying to do. If you are simply trying to end the flow and start a new flow you can do soemthing like
<view-state id="createXYZ" view="createXYZ">
<transition on="cancel" to="endFlow"></transition>
</view-state>
<end-state id="endFlow" view="externalRedirect:../myOtherFlow.action"/>
This will not only end the flow you were just working on (which is very useful) but also start the new flow. In this case the new flow is called myOtherFlow