Results 1 to 3 of 3

Thread: RequestScope and request parameters

  1. #1
    Join Date
    Aug 2004
    Location
    Paderborn, Germany
    Posts
    24

    Default RequestScope and request parameters

    Hi,
    I have the following form in my JSP page:

    Code:
    <form method="POST" action="flowController">
    
    <input type="hidden" name="_flowExecutionId" value="<c&#58;out value=$&#123;"flowExecutionId"&#125;/>"/>
    
    <input type="hidden" name="formatted" value="true"/>
    
    <input type="submit" name="_eventId" value="export"/>
    </form>
    When this form is submitted a MultiAction is called and I expected the request parameter formatted to be in the RequestScope, but there is no such parameter(the RequestScope is empty).

    I can get the paramter with this code:
    Code:
    context.getSourceEvent&#40;&#41;.getParamter&#40;"formatted"&#41;;

    but why do I need the RequestScope then?
    Ok, I can store data in it to display them in a ViewAction that follows my MultiAction. But why doesn't it work the other way round? Have I done something wrong? Do I have to use a FormObject everytime I want to get RequestParameters from the RequestScope (Even If I only have an url encoded link with additional parameters)? And what's about the RequestContext.getModel() method. Again an additional way to store request data? I think I've understood what the FlowScope is all about, but I'am a little confused with the way SWF uses the RequestScope.

    Clarifying words are appreciated :-)

    Chris
    It\'s better to be an optimist who is sometimes wrong than a pessimist who is always right!

    90% of the PC problems are between the keyboard and the chair

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    In a HTTP environment, we treat the HttpServletRequest as a source event parameter source. Think about it -- something happens -- e.g. the user presses the submit button. Along with that event, come contextual data about what happened e.g the form field values they typed in. We treat that data consistently as event parameters.

    Now request scope is a context for data that exists after a request into the webflow system is triggered (by the occurence of an external event). So actions can put stuff in request scope for reference, for example, and anything in request scope automatically gets exposed in the view model for purposes of rendering. Data in request scope only lives for the life of a single request into the webflow system.

    Keith
    Keith Donald
    Core Spring Development Team

  3. #3
    Join Date
    Aug 2004
    Location
    Paderborn, Germany
    Posts
    24

    Default

    Thx for the fast answer:-D

    Chris
    It\'s better to be an optimist who is sometimes wrong than a pessimist who is always right!

    90% of the PC problems are between the keyboard and the chair

Similar Threads

  1. Request parameters not in command object
    By fallofrome in forum Web Flow
    Replies: 4
    Last Post: Aug 2nd, 2005, 04:10 PM
  2. Replies: 4
    Last Post: Jun 3rd, 2005, 05:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •