Have you tried with exceptions-handlers:
Code:
<!-- Apply exception handler to display messages within flow -->
<exception-handler bean="flowExceptionMessageHandler" />
Code:
public class FlowExceptionMessageHandler implements FlowExecutionExceptionHandler {
/** {@inheritDoc} */
public boolean canHandle(FlowExecutionException ex) {
return canHandle(ex.getFlowId(), ex.getStateId())
&& canBuildMessage(ex);
}
public boolean canHandle(String flowId, String stateId) {
return stateId != null;
}
/**
* Handle the exception in the context of the current request, optionally
* making an error view selection that should be rendered.
*
* @param exception
* the exception that got thrown during flow execution
* @param context
* the execution control context for this request
*/
public void handle(FlowExecutionException ex, RequestControlContext context) {
logException(ex, context);
context.getMessageContext().addMessage(buildMessage(ex, context));
// Redirect to originating view state to display message
if (context.getCurrentState().isViewState()) {
context.getExternalContext().requestFlowExecutionRedirect();
} else {
State originatingViewState = (State)context.getRequestScope().get("webflow.originatingViewState");
if (originatingViewState != null) {
context.execute(new Transition(new DefaultTargetStateResolver(originatingViewState.getId())));
}
}
}
...
...
}
or transition on exception
Code:
<global-transitions>
<!-- Global transitions to global states -->
<!--
- Global transition exception handling.
- Adding a transition on-exception here will override custom
- exception-handlers.
- Use only for exceptions that cannot be handle within the current
- state and need to be redirected to another url.
-->
</global-transitions>
Code:
<!--
- This state defines a new subflow to be called from
- the current one.
- When exiting a subflow execution should proceed to the previous
- view state.
-->
<subflow-state id="subflow" subflow="template">
<transition on="back" to="${requestScope['webflow.originatingViewState'].id}" />
<transition on="previous" to="${requestScope['webflow.originatingViewState'].id}" />
<transition on-exception="org.springframework.security.AccessDeniedException" to="${requestScope['webflow.originatingViewState'].id}" />
<transition on-exception="FlowInputMappingException" to="${requestScope['webflow.originatingViewState'].id}" />
</subflow-state>