Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass parameters to spring webflow

I am working on spring webflows. I have two webflows in my application, one to add a person details and one to modify the person details. Both flows are working fine. Now I would like to pass parameter(s) to my modify flow and access it, so that I can preselect some of the values based on the passed parameter. How can I achieve it for below mentioned scenarios?

  1. From the Add flow end state.
  2. From outside the flow i.e from anywhere in the application except add flow.
like image 430
Hari Narayanan Avatar asked Mar 19 '23 10:03

Hari Narayanan


1 Answers

I figured it out. In the end it was very simple and i just had to pass the parameters in url and get the parameters that I pass using input tag in the flow.xml. Earlier i wasn't using the input tag.

Url will be something like ths

http://localhost:8080/modifyPerson?personName=xxx

Then in flow.xml personName parameter that is passed is retrieved using input tag and set to the model.

 <input name="personName"/>

 <view-state id="modifyBasics" view="modifyBasics" model = "person">
    <on-render>
        <set name="person.personName" value="personName"></set>
    </on-render>
    ....
 </view-state>
like image 63
Hari Narayanan Avatar answered Apr 06 '23 22:04

Hari Narayanan