【问题标题】:Failed transition between pages using Spring webflow使用 Spring webflow 在页面之间转换失败
【发布时间】:2013-06-28 17:53:32
【问题描述】:

我正在尝试将 Spring-webflow 与 Spring-MVC 结合使用。我按照 Spring 参考中提到的步骤进行操作,并且可以访问第一页,其中包含以下代码:

<%@page isELIgnored="false" %>
<html>
<head>
<title>Import</title>
</head>
<body>
    <a href="${flowExecutionUrl}&_eventId=facebook">Import facebook
        datas</a>
</body>
</html>

但是,它会将我重定向到 localhost/myAPP/&_eventId=facebook,并出现 404 错误。

这是我的 servlet 配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans"
    xmlns:webflow="http://www.springframework.org/schema/webflow-config"
    xsi:schemaLocation="
            http://www.springframework.org/schema/mvc               http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
            http://www.springframework.org/schema/beans             http://www.springframework.org/schema/beans/spring-beans-3.0.xsd    
            http://www.springframework.org/schema/webflow-config    http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.4.xsd    
            http://www.springframework.org/schema/context           http://www.springframework.org/schema/context/spring-context-3.0.xsd">


    <import resource="properties.xml" />

    <context:component-scan base-package="com.dynamease.web.social" />
    <context:annotation-config />

    <mvc:annotation-driven />

    <mvc:interceptors>
        <bean class="com.dynamease.entity.springsocialentities.UserInterceptor">
            <constructor-arg ref="usersConnectionRepository" />
        </bean>
    </mvc:interceptors>

    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/views/" />
        <property name="suffix" value=".jsp" />
    </bean>
    <bean id="viewResolverImport"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/views/import/" />
        <property name="suffix" value=".jsp" />
    </bean>

    <!-- Allows users to sign-in with their provider accounts. -->
    <bean class="org.springframework.social.connect.web.ProviderSignInController">
        <constructor-arg ref="connectionFactoryLocator" />
        <constructor-arg ref="usersConnectionRepository" />
        <constructor-arg>
            <bean class="com.dynamease.entity.springsocialentities.SimpleSignInAdapter" />
        </constructor-arg>
    </bean>


    <mvc:view-controller path="/signin" />
    <mvc:view-controller path="/signout" />
    <mvc:view-controller path="/import/import"/>

    <!-- Spring web flow -->
    <bean id="viewFactoryCreator"
        class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
        <property name="viewResolvers" ref="viewResolverImport" />
    </bean>
    <webflow:flow-builder-services id="flowBuilderServices"
        view-factory-creator="viewFactoryCreator" />

    <webflow:flow-registry id="flowRegistry"
        flow-builder-services="flowBuilderServices">
        <webflow:flow-location path="/web-INF/views/import/registryImport.xml" />
    </webflow:flow-registry>

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

    <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>
</beans>

这是我的 webflow 配置文件:

<?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-2.0.xsd">

    <view-state id="import" view="import.jsp">
        <transition on="facebook" to="facebook" />
    </view-state>

    <end-state id="facebook" />
</flow>

我想我在 url 解析器的某个地方失败了,但我不能说在哪里。有什么想法吗?

【问题讨论】:

    标签: java spring jsp spring-mvc spring-webflow


    【解决方案1】:

    它会将您重定向到 *localhost/myAPP/&_eventId=faceboo* 但它应该是这样的:

    localhost/myAPP/registryImport?execution=s1e1&_eventId=facebook
    

    带有此链接的页面上浏览器显示的地址是什么?你如何开始你的流程?

    【讨论】:

    • 为了回答您的第二个问题,我先转到 myApp/import/import 开始流程。我现在无法尝试您的建议,我会尽快通知您。跨度>
    猜你喜欢
    • 1970-01-01
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多