春季:无法获得此流程的模型

时间:2019-01-28 10:04:00

标签: spring spring-boot spring-webflow

我已经在项目中编写了spring-web-flow。当我点击该流时,它显示为

错误
Caused by:org.springframework.webflow.engine.model.builder.FlowModelBuilderException : Could not access the XML flow definition at ServletContext resource /WEB-INF/webapp/xxx-webflow.xml

am出现上述错误,并在尝试访问流程时显示为无法获取该流程的模型, 找到我下面的代码以供参考。

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

    <webflow:flow-registry id="flowRegistry"
        flow-builder-services="flowBuilderServices" base-path="/WEB-INF">
        <!-- here the id is mapped to invoke this flow -->
        <webflow:flow-location id="forgotPasswordFlow" path="/webapp/xxx-webflow.xml" />
    </webflow:flow-registry>

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

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

    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="viewClass"
            value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/templates/" />
        <property name="suffix" value=".html" />
    </bean>

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

    <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
        <property name="flowRegistry" ref="flowRegistry" />
        <property name="order" value="0" />
    </bean>


and my xxx.xml file is

<view-state id="viewForgotPasswordForm" view="/templates/casForgetPasswordView.html"
        model="forgotPasswordCredential">
        <binder>
            <binding property="userId" required="true" />
            <binding property="tenantId" required="true" />
        </binder>
        <transition on="submit" bind="true" validate="true"
            to="forgotPasswordWebflowInitialization" />
    </view-state>

1 个答案:

答案 0 :(得分:0)

您的配置似乎正在寻找WEB-INF/webapp/xxx-webflow.xml。如果您的文件确实位于webapp/webflow/xxx--webflow.xml,则应使用以下配置:

<webflow:flow-registry id="flowRegistry"
    flow-builder-services="flowBuilderServices" base-path="/webflow">
    <!-- here the id is mapped to invoke this flow -->
    <webflow:flow-location id="forgotPasswordFlow" path="xxx-webflow.xml" />
</webflow:flow-registry>