springspring-mvcspring-webflow-2event-id

Invalid _eventId in spring webflow


Is there any way to handle unexisting eventIds or absence of eventId parameter in spring webflow?

e.g. for this webflow

<flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
    <view-state id="welcome">
        <transition on="goForward" to="nextStep"/>
    </view-state>
    <view-state id="nextStep">
        <transition on="endFlow" to="finishStep" />
    </view-state>
    <end-state id="finishStep"/>    
    <global-transitions>
        <transition on="cancel" to="finishStep"/>
    </global-transitions>
</flow>

How to handle requests with param like _eventId=unexistingAction or requests with no _eventId param ? This will normally produce a page with stack trace...

no transition found on occurence of event in state of flow...

Solution

  • This is how you can handle transitions that don't exist:

    <global-transitions>
        <transition on-exception="org.springframework.webflow.engine.NoMatchingTransitionException" to="handlingViewState">
            <evaluate expression="handlingBean.handle(flowExecutionException)"></evaluate>
        </transition>
    </global-transitions>