其他分享
首页 > 其他分享> > spring webflow中的_eventId无效

spring webflow中的_eventId无效

作者:互联网

有没有办法在spring webflow中处理未发生的eventId或没有eventId参数?

例如对于这个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>

如何使用_eventId = unexistingAction或没有_eventId参数的请求处理请求?
这通常会产生一个带有堆栈跟踪的页面……

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

解决方法:

这是您可以处理不存在的转换的方法:

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

标签:spring,spring-mvc,event-id,spring-webflow-2
来源: https://codeday.me/bug/20190825/1719912.html