Announcement Announcement Module
No announcement yet.
Quick question on use of session - Please help. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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 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"?>

    <flow start-state="beginTest">

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

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

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

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

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

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

    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....