【问题标题】:Spring Webflow: No actions were executedSpring Webflow:未执行任何操作
【发布时间】:2013-04-12 12:59:23
【问题描述】:

我正在尝试在 SWF 中实现一个动作,但即使在最简单的示例中我也会遇到同样的错误。

错误:“java.lang.IllegalStateException:未执行任何操作,因此我无法执行任何状态转换”

import org.springframework.webflow.execution.Action;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;

public class HelloAction implements Action {
@Override
public Event execute(RequestContext rc) throws Exception {                
    return new Event(this, "success");
}

我已经声明了 bean。

 <bean id="helloAction" class="app.action.HelloAction"/>

在 flow.xml..

<action-state id="intermedio">
   <action bean="helloAction"/>
   <transition on="success" to="fin"/>
</action-state>

<end-state id="fin" view="final" />

如果我不使用“HelloAction”,它可以正常工作。但是如果我想在 SWF 中使用 Action,我总是会得到以前的错误。

还需要什么吗?

提前致谢。

【问题讨论】:

    标签: spring-webflow


    【解决方案1】:
    <action-state id="intermedio">
        <evaluate expression="helloAction.execute()">
        <transition on="success" to="fin"/>
    </action-state>
    

    【讨论】:

    • 如果我使用该选项,我会得到:org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: 从元素“评估”开始发现无效内容。我也试过:
    • 哦,哇。你又回到了 Spring Web Flow 1.0。有什么特别的原因吗? (我的例子是 2.x)
    • 理论上,我的例子也是2.x。我正在使用库 2.x
    • 您使用这种方法描述的错误和 evaluate-action 元素指向您没有引用 2.0 架构。你这样做吗?
    • 好的!你是对的。如果我引用 2.0 模式,我不能使用 &lt;action&gt; 元素。出于这个原因,我将引用更改为 1.0。当我尝试使用&lt;evaluate expression&gt; 元素时,我忘记再次更改它。它完美地适用于:&lt;evaluate expression="helloAction"/&gt;(没有 .execute())。非常感谢!!
    猜你喜欢
    • 1970-01-01
    • 2012-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-26
    • 1970-01-01
    • 2012-04-16
    • 1970-01-01
    相关资源
    最近更新 更多