【问题标题】:No flow definition found. Spring web flow未找到流定义。春季网络流
【发布时间】:2011-02-21 15:45:32
【问题描述】:

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

我收到如下错误,

    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


    【解决方案1】:

    你的行为就像你进入了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>
    

    【讨论】:

      【解决方案2】:

      看起来 ${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>  
      

      【讨论】:

        猜你喜欢
        • 2010-12-23
        • 2010-12-15
        • 1970-01-01
        • 2020-04-16
        • 2020-12-18
        • 2011-03-19
        相关资源
        最近更新 更多