找不到流定义。春天的网络流量

时间:2010-05-20 00:32:46

标签: spring spring-webflow spring-webflow-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版本。

提前致谢, SD

2 个答案:

答案 0 :(得分: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>

答案 1 :(得分: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>