Установка Spring Web Flow 2, не рендеринг ${flowExecutionUrl} и даже не запуск

Я собираю простое приложение Spring MVC с приложением Web Flow, и я не могу заставить его отображать потокExecutionUrl на странице, чтобы я мог перейти к следующему состоянию. Я предполагаю, что поток не запускается (есть ли явный триггер?). Я предполагаю, что в моей настройке что-то не так, хотя в журналах указано, что я правильно регистрирую файл flow.xml.

Моя весенняя конфигурация (mvc-dispatcher-servlet.xml):

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans     
    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-3.1.xsd
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
    http://www.springframework.org/schema/mvc 
    http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
    http://www.springframework.org/schema/webflow-config
    http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd">
<context:component-scan base-package="com.intl.cigna.ecommerce.controller" />

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix">
        <value>/WEB-INF/view/</value>
    </property>
    <property name="suffix">
        <value>.jsp</value>
    </property>
</bean>
<mvc:annotation-driven/>

<!-- Forwards requests to the "/" resource to the "welcome" view -->
<mvc:view-controller path="/" view-name="welcome"/>

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
  <property name="persistenceUnitName" value="com.intl.cigna"/>

<!-- Configures Handler Interceptors -->   
<mvc:interceptors>
    <!-- Changes the locale when a 'locale' request parameter is sent; e.g. /?locale=de -->
    <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
</mvc:interceptors>

<!-- Saves a locale change using a cookie -->
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver" />

<!-- Application Message Bundle -->
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basename" value="/WEB-INF/messages/messages" />
    <property name="cacheSeconds" value="0" />
</bean>

<!-- Enables FlowHandler URL mapping -->
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
    <property name="flowExecutor" ref="flowExecutor" />
</bean>
<webflow:flow-executor id="flowExecutor" />
<!--
    Maps request paths to flows in the flowRegistry; e.g. a path of
    /hotels/booking looks for a flow with id "hotels/booking"
-->
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
    <property name="flowRegistry" ref="flowRegistry" />
    <property name="order" value="0" />
</bean>

<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices">
    <webflow:flow-location path="/WEB-INF/view/flow.xml" />
</webflow:flow-registry>

<webflow:flow-builder-services id="flowBuilderServices"
    view-factory-creator="mvcViewFactoryCreator" />

<bean id="mvcViewFactoryCreator"
    class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
    <property name="viewResolvers" ref="viewResolver" />
</bean>

And my flow.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<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.xsd">

    <view-state id="step1" view="step1">
        <transition on="next" to="step2"/> 
        <transition on="cancel" to="cancel"/>
    </view-state>

    <view-state id="step2" view="step2">
        <transition on="previous" to="step1"/>
        <transition on="finish" to="success"/>
        <transition on="cancel" to="cancel"/>
    </view-state>

    <end-state id="success" view="flows/success"/>

    <end-state id="cancel" view="flows/cancel"/>

</flow>

Я могу успешно перейти к представлениям.

И мой JSP:

<html>
<head>
    <title>spring mvc web flow</title>
    <link rel="stylesheet" href="<c:url value="/resources/css/demo_page.css"/>" type="text/css"></link>
    <link rel="stylesheet" href="<c:url value="/resources/css/demo_table.css"/>" type="text/css"></link>
</head>
<body id="dt_example">
    <div id="container">
        <div>
            <p class="notice">This is step 1 of the web flow</p>
            <form id="step1" action="${flowExecutionUrl}" method="POST">
                <button id="cancel" type="submit" name="_eventId_cancel">Cancel</button>
                <button id="next" type="submit" name="_eventId_next">Next &gt;&gt;</button>
                <a href="${flowExecutionUrl}&_eventId=next">Next</a>
                <c:out value="${flowExecutionUrl}"/>

            </form>
        </div>
    <%@ include file="/WEB-INF/view/footer.jsp" %>
    </div>
</body>
</html>

person enkor    schedule 10.10.2012    source источник


Ответы (1)


Хорошо, понял... Чтобы запустить поток, вам нужно использовать идентификатор потока в URL-адресе. Поэтому в моем случае используйте URL-адрес «http://localhost:8080/SpringMVC/flow» для потока с идентификатором «flow». Я предполагал, что поток начинается, когда вы указываете на вид.

person enkor    schedule 11.10.2012