Search code examples
springspring-webflow

how to persist a data in Action State/on start even of a flow in Spring Web Flow


I am having a simple problem. On start of my flow I want to access a method of a class. I will process some data in that method and I have four variables that I want to pass into the next view state. So far I know is that I have to put this variables in flowscope so that I can use it in the entire flow.

    <on-start>
        <evaluate expression="className.methodName()" result="???" />
    </on-start>

<-- my view state is -->

 <view-state id="basicData" view="initialScreen">
      <transition on="tabClick" to="tabSingleClick"></transition>
      <transition on="listClick" to="list"></transition>
</view-state>

Solution

  • from your method you can use RequestContextHolder to access the RequestContext and flow scope parameter map.

    then add the parameters you want