Announcement Announcement Module
No announcement yet.
flowScope problem Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • flowScope problem

    Hi all,

    I have been having a lot of difficulty moving an object in and out of flowScope through one of my flows. There are three stages to the flow - enter basic details, select a forecast strategy and complete the forecast. All three stages use the same object, stored in my flowScope as yearlyForecast.

    My flow definition looks like this:
    <flow ... namespace details removed>
    	<input name="id" value="" />
    	<!-- determine whether to create or edit -->
    	<decision-state id="createOrEdit">
            <if test="id == null" then="create" else="edit" />
        <action-state id="create">
            <evaluate expression="forecastsService.initialiseForecast()" result="flowScope.yearlyForecast" />
            <transition to="enterYearlyForecastInformation" />
        <action-state id="edit">
            <evaluate expression="forecaster.getYearlyForecast(id)" result="flowScope.yearlyForecast" />
            <transition to="enterYearlyForecastInformation" />
    	<!-- initialise reference data -->   
        <view-state id="enterYearlyForecastInformation" view="forecasts/yearly-forecast" model="yearlyForecast">
        		<evaluate expression="refdataDataService.listHotels()" result="" />
            <transition on="save" to="enterRoomNightsAndRate">
            	<evaluate expression="forecastsService.createYearlyForecast(yearlyForecast)" result="flowScope.yearlyForecast" />
    	<view-state id="enterRoomNightsAndRate" view="forecasts/room-nights-and-rate" model="yearlyForecast">
            <transition on="save" to="enterMonthlyForecast">
            	<evaluate expression="forecastsService.saveRoomNightsAndRate(yearlyForecast)" result="flowScope.yearlyForecast" />
        <view-state id="enterMonthlyForecast" view="forecasts/monthly-forecast" model="yearlyForecast">
            <transition on="confirm" to="monthlyForecastComplete" />
        <end-state id="monthlyForecastComplete">
        	<output name="yearlyForecast" value="flowScope.yearlyForecast" /> 
    The initial forecast is created and the view displays. When I post the form back, binding works successfully (I can see from debug). The service saves the details to the db successfully too and I return the newly saved object from the createYearlyForecast method. However, when I move to the next JSP, none of the data from the saved object is available.

    Does anyone know where I might be going wrong? I've looked at several examples and the reference documentation which point to the approach I've taken being the correct one.

    Presumably when each time I set a result back into flowScope.yearlyForecast the old object is replaced? Likewise I presume that using the spring tags and binding to say should return the value correctly?

    Thanks to anyone who can offer me some assistance