1

This query is about passing a flow-scope variable from one view-state to other view-state in spring-webflow.

Below code is a flow.xml file. 1. I have 2 view states in this file('firstView', 'secondView'). 2. Here start-state is a view-state 'firstView', and on start I am setting a variable 'customizeBean' in flowscope. 3. In 'firstView' view-state a transition 'selectUsers' is defined, which calls another view-state 'secondView'. 4. I want to access flow-scope variable 'customizeBean' in second view state 'secondView', basically I want to access 'customizeBean' on 'twinPickers.xhtml' page. 5.Please let me know how can I pass 'customizeBean' from first view state to second view-state.

 <?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>
Java Hunger
  • 139
  • 2
  • 11
  • Presumably your `customizeReport-bean.xml` contains a bean with the name "customizeBean", correct? – dbreaux Jan 24 '14 at 14:46

1 Answers1

2

Objects stored in the flowScope are available to all views in the flow for the life of the flow. You shouldn't have to pass them from view-state to view-state. Is the object you are storing in the flowScope Serializable?

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

dvause
  • 166
  • 1
  • 6