How do I update data in a Spring WebFlow Model and Pass it back to the same view.
I have a project that I am working on and if the user picks a item from a selectbox I need to go back to the server in fill in some data to the model that needs to be displayed on the view.
You can see from my view-state that once the item is picked I setoff a transition for SelectBoxPicked and call my controller with the model but how do I return the updated model to the view?
Can someone please tell me what to put into my java (controller) code and also in my flow.xml to make this work.
<view-state id="SchoolVisitReport" view="SchoolVisitReport.jsp" model="visit" >
<transition on="submit" to="addVisit">
<evaluate expression="flowActions.validateVisit(visit, messageContext)"/>
</transition>
<transition on="loadSchools" to="SchoolVisitReport" >
<evaluate expression="flowActions.initializeSelectableSchools(visit)" result="flowScope.selectableSchools"/>
</transition>
<transition on="SelectBoxPicked" to="SchoolVisitReport" >
<evaluate expression="flowActions.fillDetails(visit)" />
</transition>
<transition on="cancel" to="endState" bind="false"/>
</view-state>
That basic approach works; we’ve used it ourselves. The Java code you call from the evaluate method can return
falseto prevent the transition, although that will just transition back to the current state anyway. I believe anything other thanfalsewill take your transition.