找不到流定义。弹簧网络流

问题描述 投票:0回答:2

我是 Spring webflow 的新手,现在我正在尝试 Spring 食谱书中的示例,我知道这是一个基本问题。

我得到如下错误,

    org.springframework.webflow.definition.registry.NoSuchFlowDefinitionException: No flow definition '${flowExecutionUrl}&_eventId=next' found
    at org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl.getFlowDefinitionHolder(FlowDefinitionRegistryImpl.java:126)
    at org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl.getFlowDefinition(FlowDefinitionRegistryImpl.java:61)
    at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:138)
    at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)....  

下图是我的配置,

    <bean name="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
        <property name="flowExecutor" ref="flowExecutor"></property>
    </bean>

    <webflow:flow-executor id="flowExecutor" />

    <webflow:flow-registry id="flowRegistry" >
        <webflow:flow-location path="/WEB-INF/flows/welcome/welcome.xml"></webflow:flow-location>
    </webflow:flow-registry>  

/WEB-INF/flows/welcome/welcome.xml,

<view-state id="welcome">
    <transition on="next" to="introduction" />
    <transition on="skip" to="menu" />
</view-state>

<view-state id="introduction">
    <on-render>
        <evaluate expression="libraryService.getHolidays()" result="requestScope.holidays" />
    </on-render>
    <transition on="next" to="menu" />
</view-state>

<view-state id="menu"></view-state>  

在welcome.jsp中,

    <a href="${flowExecutionUrl}&_eventId=next">Next</a>
    <a href="${flowExecutionUrl}&_eventId=skip">Skip</a>  

请让我知道出了什么问题。我正在使用 2.0.9 版本。

提前致谢, 标准差

spring spring-webflow spring-webflow-2
2个回答
0
投票

你的行为就像你进入了

welcome
流程,但你没有。尝试在项目的根目录中创建 index.html 文件并将以下链接放在那里(供用户手动输入您的应用程序)

<a href="welcome">Enter application</a>

...或跟随自动导航到您的流程:

<html>
<head>
    <meta http-equiv="Refresh" content="0; URL=spring/welcome"/>
</head>
</html>

... 其中

spring
是 web.xml 中 Spring MVC Dispatcher Servlet 的 url 模式(比方说

<servlet>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value></param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>

<!-- Map all /spring requests to the Dispatcher Servlet for handling -->
<servlet-mapping>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <url-pattern>/spring/*</url-pattern>
</servlet-mapping>

0
投票

看起来 ${flowExecutionKey} 的值没有被填充。试试这个

<c:out value='${flowExecutionKey}'/>

所以welcome.jsp看起来像

<a href="<c:out value='${flowExecutionKey}'/>&_eventId=next">Next</a><a href="<c:out value='${flowExecutionKey}'/>&_eventId=skip">Skip</a>  
© www.soinside.com 2019 - 2024. All rights reserved.