Results 1 to 6 of 6

Thread: Need help with accessing POST-variables

  1. #1
    Join Date
    Apr 2007
    Posts
    17

    Default Need help with accessing POST-variables

    Hi,
    I'm trying to read in some form data in a method that i called via a rendering-action element.

    so i have that jsp with my form and a hidden field for the flow-key and my object id:

    Code:
    <form action="wizard" method="post">
    	<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}" />
    	<input type="hidden" name="objectId" value="${sessionScope.object.objectId}" /> 
    	...
    then the transition leads me to this view:
    Code:
    <view-state id="feature" view="cpWizard/feature">
    		<render-actions>
    			<action bean="createObjectController" method="getObjects"/>
           	</render-actions>
    
    ...
    and inside my objectController the getObjects method is successfully called. i tried to print out all entries of all maps stored in each scope or context i could access via the RequestContext object and i could not find my objectId from that hidden field.

    how can i access that simple value?

  2. #2
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    452

    Default

    Hi,

    have you tried

    contextPar.getRequestParameters().asMap() ?

    Normally here you can find all request Parameters from the underlying external context.

    Regards
    lyserg

  3. #3
    Join Date
    Apr 2007
    Posts
    17

    Default

    no, didn't work. i tried also
    context.getExternalContext().getRequestParameterMa p().asMap()
    context.getExternalContext().getRequestMap().asMap ()
    context.getRequestParameters().asMap()
    context.getFlowScope().asMap()
    context.getActiveFlow().getAttributes().asMap()
    ...and some more...

    is it only possible to access the parameters when i use a formAction (didn't tried this out, yet)?

  4. #4
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    452

    Default

    Hi,

    this is crazy, normally you can access all the request paramters like explained.
    Could you please check if the paramter is really filled while sending back to the server. (By looking into the page source)

    Regards
    lyserg

  5. #5
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    All request parameters of the current request are in the context.getRequestParameters map. You're probably having an alwaysRedirectOnPause side effect:

    http://www.ervacon.com/products/swf/tips/tip4.html

    The event processing phase and render phase happen in completely separate requests. As a result any request parameters submitted with the first request (event processing phase) will no longer be available when the view is rendered in the second request (render phase). Capture any required request parameters in flash scope or flow scope to make them available for view rendering.
    Erwin

  6. #6
    Join Date
    Apr 2007
    Posts
    17

    Default

    Thanks for that hint, Erwin! Since I called my method as a render-action it couldn't work. I changed it to an entry-action and my data is where I expected it to be...

    Thanks a lot!

Posting Permissions

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