【问题标题】:How to pass a flow-scope variable from one view-state to other view-state in spring-webflow如何在spring-webflow中将流范围变量从一个视图状态传递到另一个视图状态
【发布时间】:2014-01-18 05:56:29
【问题描述】:

此查询是关于将流范围变量从一个视图状态传递到 spring-webflow 中的另一个视图状态。

下面的代码是一个 flow.xml 文件。 1. 我在这个文件中有 2 个视图状态('firstView'、'secondView')。 2. 这里的 start-state 是一个视图状态“firstView”,开始时我在 flowscope 中设置了一个变量“customizeBean”。 3. 在“firstView”视图状态中定义了一个转换“selectUsers”,它调用另一个视图状态“secondView”。 4. 我想在第二个视图状态“secondView”中访问流范围变量“customizeBean”,基本上我想访问“twinPickers.xhtml”页面上的“customizeBean”。 5.请告诉我如何将“customizeBean”从第一个视图状态传递到第二个视图状态。

 <?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"
    start-state="firstView" parent="reportStandard" >

    <on-start>
        <set name="flowScope.customizeBean" value="customizeBean" />
    </on-start>

    <view-state id="firstView" view="customizeReport.xhtml">
            <transition on="selectUsers" to="secondView" />     
    </view-state>

    <view-state id="secondView"
        view="/WEB-INF/twinPickers.xhtml">
        <on-entry>
            <evaluate expression="reportAction.createTwinPicker" />
        </on-entry>
    </view-state>

    <bean-import resource="customizeReport-bean.xml" />
</flow>

【问题讨论】:

  • 大概你的customizeReport-bean.xml 包含一个名为“customizeBean”的bean,对吗?

标签: viewstate spring-webflow flow-scope


【解决方案1】:

存储在 flowScope 中的对象在流的整个生命周期内都可用于流中的所有视图。您不必将它们从视图状态传递到视图状态。您存储在 flowScope 中的对象是否可序列化?

http://docs.spring.io/spring-webflow/docs/2.3.2.RELEASE/reference/html/ch04s04.html#el-variable-flowScope

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-24
    • 1970-01-01
    • 2016-12-24
    • 1970-01-01
    • 2015-10-27
    • 1970-01-01
    相关资源
    最近更新 更多