Announcement Announcement Module
Collapse
No announcement yet.
RequestScope and request parameters Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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

    Comment


    • #3
      Thx for the fast answer:-D

      Chris

      Comment

      Working...
      X