我被分配了一个将 spring-webflow-1.0 项目迁移到 spring-webflow-2.4 的情况。 另外,我还被要求保留原始的 _flowId 标识,即 /flows.htm?_flowId=booksearch
为了做到这一点,我将下面由 spring 加载的 flow-definition.xml 放在一起。它使用我在几个地方提到过的 WebFlow1FlowUrlHandler 来允许您维护基于 WebFlow1 的 url 匹配,但以下 url 都找不到任何内容
http://localhost:8080/SpringWebFlowExamples/flows.html?_flowId=booksearch http://localhost:8080/SpringWebFlowExamples/flows.html?_flowId=pensionclaims
booksearch-flow.xml 和pensionclaims-flow.xml 的定义位于webapps/flows 中但无济于事?
有人有什么想法吗?
谢谢, 马克。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:flow="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry"/>
</bean>
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor"/>
</bean>
<flow:flow-executor id="flowExecutor" flow-registry="flowRegistry"/>
<flow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices">
<flow:flow-location-pattern value="/flows/*-flow.xml"/>
</flow:flow-registry>
<flow:flow-builder-services id="flowBuilderServices" view-factory-creator="mvcViewFactoryCreator"
development="true"/>
<bean id="internalResourceViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="mvcViewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="viewResolvers" ref="internalResourceViewResolver"/>
<property name="useSpringBeanBinding" value="true"/>
</bean>
<bean name="/flows.html" class="org.springframework.webflow.mvc.servlet.FlowController">
<property name="flowExecutor" ref="flowExecutor"/>
<property name="flowUrlHandler">
<bean class="org.springframework.webflow.context.servlet.WebFlow1FlowUrlHandler"/>
</property>
</bean>
我遇到了同样的问题,并通过在 Spring Webflow 类中添加调试断点解决了该问题:
org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl
在 registerFlowDefinition
方法中。
它让我可以看到这些流程保存在哪些键下。
对我来说,问题是我没有使用流程位置而不是流程位置模式标签。