Announcement Announcement Module
No announcement yet.
pass parameter to start of flow Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • pass parameter to start of flow

    Just got started with the web flow project. Have got some examples up and running and well pleased over previous spring mvc code.

    One question though, and apologies if its obvious, I have tried searching the forum to no avail.

    How can I pass some request paramters into a flows start to give it some business context ? I see it as most useful when splitting flows down into reusable sub-flows.

    eg. anchor href to

    How do I configure start-state of editUserDetailsFlow to retrieve the id value and store it in the flow ?

    How do I then access them from other states/actions in the flow ?

    any help appreciated,


  • #2
    Simply have an action that does the binding (i.e. extends FormAction) and call that in your initial action state.

    There is nothing "special" about the start of a flow


    • #3
      Thanks. The kick I needed.

      Another case of read the fing samples. Further search in phonebook found I needed

      <setup bean="formAction" method="setupForm"/>

      to insert into my start view-state

      so now ...

      <webflow id="myFlow" start-state="viewForm">

      <view-state id="viewForm" view="myFormView">
      <setup bean="formAction" method="setupForm"/>
      <transition on="submit" to="bindAndValidate"/>

      and the all important property on my form action

      <property name="bindOnSetupForm"><value>true</value></property>

      so now ...

      <bean id="formAction" class="MyFormAction">
      <property name="validator">
      <bean id="myValidator" class="MyValidator"/>
      <property name="bindOnSetupForm"><value>true</value></property>

      This has done the trick for any other novices struggling on this one.

      thanks again for the help.[/code]


      • #4
        No probs.

        I actually do it the long way (xml is paraphrased because I am at home ):

         <flow id="myFlow" initial-state="prepareForView.action">
           <action-state id="prepareForView.action">
             <action bean="bindToMyForm" method="bindAndValidate"/>
             <transition to="myView.view" on="success"/>
          <view etc.


        • #5
          Passing parameter to flow start using jsf

          Hey everybody,

          I know this is a few years late, but I figured this out and wanted to post it somewhere.

          If you are using Spring webflow and jsf together you can pass values to the start of a flow by using the <faram> tag.

          For example:

          <h:commandLink value="#{msgs.Register}"
          <faram id="myParam" name="myParam" value="myValue"/>

          now my flow (register-flow) and access the parameter using "requestScope.myParam".

          Hope this helps somebody,