Announcement Announcement Module
Collapse
No announcement yet.
Quick question on use of session - Please help. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quick question on use of session - Please help.

    I am working on a proof of concept for my employer using SWF. I bought the Expert Spring and Web Flows book and I have searched through the forum in attempting to avoid posting. However, not much luck, although I might have overlooked something in which case, I apol.

    My scenario is simple. My flow works fine - the only problem is I am trying to to put firstManager into the session. firstManager contains an array of 10 objects of First.java and with each iteration, I call getNext and its supposed to return an element representing the next "first" object. It iterates until I exhaust the array. "first" is the object I need to work with on the jsp form.

    My action with extends FormAction has the method beginTest(RequestContext context). It does:

    context.getFlowScope().put("first", this.getNext());

    As best as I can find, none of the examples prepopulate the session with the such an object. Please enlighten me.

    How do I put firstManager into the session?


    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE flow PUBLIC "-//SPRING//DTD WEBFLOW 1.0//EN"
    "http://www.springframework.org/dtd/spring-webflow-1.0.dtd">

    <flow start-state="beginTest">

    <action-state id="beginTest">
    <action bean="firstManager"
    resultScope="flow"
    />
    <transition on="success" to="displayBeginTest"/>
    </action-state>

    <view-state id="displayBeginTest" view="test01/detailVertical">
    <entry-actions>
    <!-- action bean="firstManager" method="setupForm"/ -->
    <action bean="firstManager" method="getNext" result-name="first"/>
    </entry-actions>
    <transition on="submit" to="firstAction"/>
    </view-state>

    <action-state id="firstAction">
    <action bean="firstManager"
    method="setupForm"
    />
    <transition on="success" to="nextFirst">
    <action bean="formAction" method="bindAndValidate"/>
    </transition>
    <transition on="finish" to="doSomethingElse"/>
    </action-state>

    <view-state id="nextFirst" view="test01/detailVertical">
    <transition on="submit" to="firstAction"/>
    </view-state>

    <end-state id="doSomethingElse"/>
    <end-state id="cancel"/>

    <import resource="math-flow-context.xml"/>
    </flow>



    Thank you in advance.
    Ed Elud.

  • #2
    Resolved. I was unclear about passing the RequestContext and stuffing the bean instance into it like this
    context.getFlowScope().put("first", testArray[currentndex++]);

    Rather than use resultName="bean" in the flows xml, instead, the method called returns Event as either success() or error() after attempting to use context.getFlowScope().put....

    Comment

    Working...
    X