You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Allen, Daniel" <Da...@kbcfp.com> on 2008/04/24 21:52:59 UTC

Redirect-action parameters via POST

Hi, all.

I'm using the snippet below[1] in my struts.xml file to send finish an
action with a redirect to another, and sending a parameter along.
However, Struts 2 defaults to passing the parameter via appending it to
the URL in a GET request. I'm going to need to add additional
parameters, some of which may be extremely large, and which I'd prefer
the user not be able to easily alter. So, I would like to change things
so that the URL result is just
"webapp.com/namespace/documentUpload_input" and the parameters are
passed invisibly via POST request.

Is there a way to do that?

~Dan Allen



[1]
<action name="createPolicy" class="createPolicyAction">
	<result name="success" type="redirect-action">
		<param name="actionName">documentUpload_input</param>
		<param name="parse">true</param>
		<param name="policyId">${policyId}</param>
	</result>
</action>

-- 
This message may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived by any transmission to an unintended recipient. If you are not an intended recipient, please notify the sender and delete this message immediately. Any views expressed in this message are those of the sender, not those of any entity within the KBC Financial Products group of companies (together referred to as "KBC FP"). 

This message does not create any obligation, contractual or otherwise, on the part of KBC FP. It is not an offer (or solicitation of an offer) of, or a recommendation to buy or sell, any financial product. Any prices or other values included in this message are indicative only, and do not necessarily represent current market prices, prices at which KBC FP would enter into a transaction, or prices at which similar transactions may be carried on KBC FP's own books. The information contained in this message is provided "as is", without representations or warranties, express or implied, of any kind. Past performance is not indicative of future returns.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Redirect-action parameters via POST

Posted by Guillaume Bilodeau <gb...@yahoo.com>.
If you do insist on sending those parameters via POST, you could use a
ServletDispatcherResult (the default one) to a JSP with a form populated
with values from the action and have the form submit when the page is
loaded, either through a <body
onLoad="javascript:document.formName.submit();"> or a JS library like
jQuery.

Cheers,
GB


Guillaume Bilodeau wrote:
> 
> The use case you're describing would be best implemented using flash
> scope.  Your options include:
> 
> . use the Scope plugin
> (http://cwiki.apache.org/S2PLUGINS/scope-plugin.html)
> . implement the scope yourself using a result / interceptor pair as
> discussed in this forum
> (http://www.nabble.com/Is-there-such-a-thing-as-flash-in-S2--td16697840.html#a16866433)
> 
> Developing the scope itself is quite straightforward, but if you want some
> pointers I can help you out.
> 
> Cheers,
> GB
> 
> 
> ancatdubher wrote:
>> 
>> Redirect (by design) uses an HTTP GET request method. This means the only
>> way to pass values is in the URL. If your data is small enough, you could
>> encode/encrypt it into the URL and decode it back after the redirect - an
>> approach that isn't clean and I wouldn't recommend. (Also, the URL is
>> limited to 256 characters length).
>> 
>> The only other option is the session. 
>> 
>> 
>> 
>> Nils-Helge Garli wrote:
>>> 
>>> 
>>> Well, it sounds like something that shouldn't be possible to me... It
>>> kind of violates the whole concept of a redirect. If you really want
>>> the data to be a part of the URL, you could do some encoding to make
>>> them less readable and shorter.
>>> 
>>> Nils-H
>>> 
>>> On Thu, Apr 24, 2008 at 10:12 PM, Allen, Daniel <Da...@kbcfp.com>
>>> wrote:
>>>> I can, and I considered that, but I was hoping to keep it in the XML to
>>>>  minimize the number of files that need to be changed. The
>>>> documentUpload
>>>>  action that's the redirect target below is actually the recipient of
>>>>  quite a few links (in fact the basic point of the application is to
>>>>  facilitate document submission for various purposes).
>>>>
>>>>  If this isn't possible purely via configuration, then yeah, session
>>>>  storage is definitely my fallback plan.
>>>>
>>>>  ~DVA
>>>>
>>>>
>>>>
>>>>  -----Original Message-----
>>>>  From: Nils-Helge Garli Hegvik [mailto:nilsga@gmail.com]
>>>>  Sent: Thursday, April 24, 2008 3:58 PM
>>>>  To: Struts Users Mailing List
>>>>  Subject: Re: Redirect-action parameters via POST
>>>>
>>>>  Can you put the info on the session?
>>>>
>>>>  Nils-H
>>>>
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Redirect-action-parameters-via-POST-tp16884951p16895872.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Redirect-action parameters via POST

Posted by "Allen, Daniel" <Da...@kbcfp.com>.
Thanks for the info, guys!

I will probably end up going with the session after all, but I'll take a
look at Flash scope in that interceptor, too.

~DVA 

-----Original Message-----
From: Guillaume Bilodeau [mailto:gbilodeau@yahoo.com] 
Sent: Friday, April 25, 2008 10:09 AM
To: user@struts.apache.org
Subject: Re: Redirect-action parameters via POST


The use case you're describing would be best implemented using flash
scope. 
Your options include:

. use the Scope plugin
(http://cwiki.apache.org/S2PLUGINS/scope-plugin.html)
. implement the scope yourself using a result / interceptor pair as
discussed in this forum
(http://www.nabble.com/Is-there-such-a-thing-as-flash-in-S2--td16697840.
html#a16866433)

Developing the scope itself is quite straightforward, but if you want
some
pointers I can help you out.

Cheers,
GB


ancatdubher wrote:
> 
> Redirect (by design) uses an HTTP GET request method. This means the
only
> way to pass values is in the URL. If your data is small enough, you
could
> encode/encrypt it into the URL and decode it back after the redirect -
an
> approach that isn't clean and I wouldn't recommend. (Also, the URL is
> limited to 256 characters length).
> 
> The only other option is the session. 
> 
> 
> 
> Nils-Helge Garli wrote:
>> 
>> 
>> Well, it sounds like something that shouldn't be possible to me... It
>> kind of violates the whole concept of a redirect. If you really want
>> the data to be a part of the URL, you could do some encoding to make
>> them less readable and shorter.
>> 
>> Nils-H
>> 
>> On Thu, Apr 24, 2008 at 10:12 PM, Allen, Daniel
<Da...@kbcfp.com>
>> wrote:
>>> I can, and I considered that, but I was hoping to keep it in the XML
to
>>>  minimize the number of files that need to be changed. The
>>> documentUpload
>>>  action that's the redirect target below is actually the recipient
of
>>>  quite a few links (in fact the basic point of the application is to
>>>  facilitate document submission for various purposes).
>>>
>>>  If this isn't possible purely via configuration, then yeah, session
>>>  storage is definitely my fallback plan.
>>>
>>>  ~DVA
>>>
>>>
>>>
>>>  -----Original Message-----
>>>  From: Nils-Helge Garli Hegvik [mailto:nilsga@gmail.com]
>>>  Sent: Thursday, April 24, 2008 3:58 PM
>>>  To: Struts Users Mailing List
>>>  Subject: Re: Redirect-action parameters via POST
>>>
>>>  Can you put the info on the session?
>>>
>>>  Nils-H
>>>
>> 
>> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/Redirect-action-parameters-via-POST-tp16884951p168
95774.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


-- 
This message may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived by any transmission to an unintended recipient. If you are not an intended recipient, please notify the sender and delete this message immediately. Any views expressed in this message are those of the sender, not those of any entity within the KBC Financial Products group of companies (together referred to as "KBC FP"). 

This message does not create any obligation, contractual or otherwise, on the part of KBC FP. It is not an offer (or solicitation of an offer) of, or a recommendation to buy or sell, any financial product. Any prices or other values included in this message are indicative only, and do not necessarily represent current market prices, prices at which KBC FP would enter into a transaction, or prices at which similar transactions may be carried on KBC FP's own books. The information contained in this message is provided "as is", without representations or warranties, express or implied, of any kind. Past performance is not indicative of future returns.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Redirect-action parameters via POST

Posted by Guillaume Bilodeau <gb...@yahoo.com>.
The use case you're describing would be best implemented using flash scope. 
Your options include:

. use the Scope plugin (http://cwiki.apache.org/S2PLUGINS/scope-plugin.html)
. implement the scope yourself using a result / interceptor pair as
discussed in this forum
(http://www.nabble.com/Is-there-such-a-thing-as-flash-in-S2--td16697840.html#a16866433)

Developing the scope itself is quite straightforward, but if you want some
pointers I can help you out.

Cheers,
GB


ancatdubher wrote:
> 
> Redirect (by design) uses an HTTP GET request method. This means the only
> way to pass values is in the URL. If your data is small enough, you could
> encode/encrypt it into the URL and decode it back after the redirect - an
> approach that isn't clean and I wouldn't recommend. (Also, the URL is
> limited to 256 characters length).
> 
> The only other option is the session. 
> 
> 
> 
> Nils-Helge Garli wrote:
>> 
>> 
>> Well, it sounds like something that shouldn't be possible to me... It
>> kind of violates the whole concept of a redirect. If you really want
>> the data to be a part of the URL, you could do some encoding to make
>> them less readable and shorter.
>> 
>> Nils-H
>> 
>> On Thu, Apr 24, 2008 at 10:12 PM, Allen, Daniel <Da...@kbcfp.com>
>> wrote:
>>> I can, and I considered that, but I was hoping to keep it in the XML to
>>>  minimize the number of files that need to be changed. The
>>> documentUpload
>>>  action that's the redirect target below is actually the recipient of
>>>  quite a few links (in fact the basic point of the application is to
>>>  facilitate document submission for various purposes).
>>>
>>>  If this isn't possible purely via configuration, then yeah, session
>>>  storage is definitely my fallback plan.
>>>
>>>  ~DVA
>>>
>>>
>>>
>>>  -----Original Message-----
>>>  From: Nils-Helge Garli Hegvik [mailto:nilsga@gmail.com]
>>>  Sent: Thursday, April 24, 2008 3:58 PM
>>>  To: Struts Users Mailing List
>>>  Subject: Re: Redirect-action parameters via POST
>>>
>>>  Can you put the info on the session?
>>>
>>>  Nils-H
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Redirect-action-parameters-via-POST-tp16884951p16895774.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Redirect-action parameters via POST

Posted by KonTiki <pa...@gmail.com>.

Here are some tests which seemed to have worked with really long URL's.
Such as 2K in IE and upto 100,000 characters in Firefox.

http://www.boutell.com/newfaq/misc/urllength.html



newton.dave wrote:
> 
> --- ancatdubher <an...@gmail.com> wrote:
>> (Also, the URL is limited to 256 characters length).
> 
> I've never noticed that limitation; I haven't seen a mainstream browser
> that
> wouldn't accept or send anything much less than about 2K, and some will do
> twice that.
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Redirect-action-parameters-via-POST-tp16884951p16935375.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Redirect-action parameters via POST

Posted by Dave Newton <ne...@yahoo.com>.
--- ancatdubher <an...@gmail.com> wrote:
> (Also, the URL is limited to 256 characters length).

I've never noticed that limitation; I haven't seen a mainstream browser that
wouldn't accept or send anything much less than about 2K, and some will do
twice that.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Redirect-action parameters via POST

Posted by ancatdubher <an...@gmail.com>.
Redirect (by design) uses an HTTP GET request method. This means the only way
to pass values is in the URL. If your data is small enough, you could
encode/encrypt it into the URL and decode it back after the redirect - an
approach that isn't clean and I wouldn't recommend. (Also, the URL is
limited to 256 characters length).

The only other option is the session. 



Nils-Helge Garli wrote:
> 
> 
> Well, it sounds like something that shouldn't be possible to me... It
> kind of violates the whole concept of a redirect. If you really want
> the data to be a part of the URL, you could do some encoding to make
> them less readable and shorter.
> 
> Nils-H
> 
> On Thu, Apr 24, 2008 at 10:12 PM, Allen, Daniel <Da...@kbcfp.com>
> wrote:
>> I can, and I considered that, but I was hoping to keep it in the XML to
>>  minimize the number of files that need to be changed. The documentUpload
>>  action that's the redirect target below is actually the recipient of
>>  quite a few links (in fact the basic point of the application is to
>>  facilitate document submission for various purposes).
>>
>>  If this isn't possible purely via configuration, then yeah, session
>>  storage is definitely my fallback plan.
>>
>>  ~DVA
>>
>>
>>
>>  -----Original Message-----
>>  From: Nils-Helge Garli Hegvik [mailto:nilsga@gmail.com]
>>  Sent: Thursday, April 24, 2008 3:58 PM
>>  To: Struts Users Mailing List
>>  Subject: Re: Redirect-action parameters via POST
>>
>>  Can you put the info on the session?
>>
>>  Nils-H
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Redirect-action-parameters-via-POST-tp16884951p16893112.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Redirect-action parameters via POST

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Well, it sounds like something that shouldn't be possible to me... It
kind of violates the whole concept of a redirect. If you really want
the data to be a part of the URL, you could do some encoding to make
them less readable and shorter.

Nils-H

On Thu, Apr 24, 2008 at 10:12 PM, Allen, Daniel <Da...@kbcfp.com> wrote:
> I can, and I considered that, but I was hoping to keep it in the XML to
>  minimize the number of files that need to be changed. The documentUpload
>  action that's the redirect target below is actually the recipient of
>  quite a few links (in fact the basic point of the application is to
>  facilitate document submission for various purposes).
>
>  If this isn't possible purely via configuration, then yeah, session
>  storage is definitely my fallback plan.
>
>  ~DVA
>
>
>
>  -----Original Message-----
>  From: Nils-Helge Garli Hegvik [mailto:nilsga@gmail.com]
>  Sent: Thursday, April 24, 2008 3:58 PM
>  To: Struts Users Mailing List
>  Subject: Re: Redirect-action parameters via POST
>
>  Can you put the info on the session?
>
>  Nils-H
>
>  On Thu, Apr 24, 2008 at 9:52 PM, Allen, Daniel <Da...@kbcfp.com>
>  wrote:
>  > Hi, all.
>  >
>  >  I'm using the snippet below[1] in my struts.xml file to send finish
>  an
>  >  action with a redirect to another, and sending a parameter along.
>  >  However, Struts 2 defaults to passing the parameter via appending it
>  to
>  >  the URL in a GET request. I'm going to need to add additional
>  >  parameters, some of which may be extremely large, and which I'd
>  prefer
>  >  the user not be able to easily alter. So, I would like to change
>  things
>  >  so that the URL result is just
>  >  "webapp.com/namespace/documentUpload_input" and the parameters are
>  >  passed invisibly via POST request.
>  >
>  >  Is there a way to do that?
>  >
>  >  ~Dan Allen
>  >
>  >
>  >
>  >  [1]
>  >  <action name="createPolicy" class="createPolicyAction">
>  >         <result name="success" type="redirect-action">
>  >                 <param name="actionName">documentUpload_input</param>
>  >                 <param name="parse">true</param>
>  >                 <param name="policyId">${policyId}</param>
>  >         </result>
>  >  </action>
>
>  --
>  This message may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived by any transmission to an unintended recipient. If you are not an intended recipient, please notify the sender and delete this message immediately. Any views expressed in this message are those of the sender, not those of any entity within the KBC Financial Products group of companies (together referred to as "KBC FP").
>
>  This message does not create any obligation, contractual or otherwise, on the part of KBC FP. It is not an offer (or solicitation of an offer) of, or a recommendation to buy or sell, any financial product. Any prices or other values included in this message are indicative only, and do not necessarily represent current market prices, prices at which KBC FP would enter into a transaction, or prices at which similar transactions may be carried on KBC FP's own books. The information contained in this message is provided "as is", without representations or warranties, express or implied, of any kind. Past performance is not indicative of future returns.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Redirect-action parameters via POST

Posted by "Allen, Daniel" <Da...@kbcfp.com>.
I can, and I considered that, but I was hoping to keep it in the XML to
minimize the number of files that need to be changed. The documentUpload
action that's the redirect target below is actually the recipient of
quite a few links (in fact the basic point of the application is to
facilitate document submission for various purposes). 

If this isn't possible purely via configuration, then yeah, session
storage is definitely my fallback plan.

~DVA

-----Original Message-----
From: Nils-Helge Garli Hegvik [mailto:nilsga@gmail.com] 
Sent: Thursday, April 24, 2008 3:58 PM
To: Struts Users Mailing List
Subject: Re: Redirect-action parameters via POST

Can you put the info on the session?

Nils-H

On Thu, Apr 24, 2008 at 9:52 PM, Allen, Daniel <Da...@kbcfp.com>
wrote:
> Hi, all.
>
>  I'm using the snippet below[1] in my struts.xml file to send finish
an
>  action with a redirect to another, and sending a parameter along.
>  However, Struts 2 defaults to passing the parameter via appending it
to
>  the URL in a GET request. I'm going to need to add additional
>  parameters, some of which may be extremely large, and which I'd
prefer
>  the user not be able to easily alter. So, I would like to change
things
>  so that the URL result is just
>  "webapp.com/namespace/documentUpload_input" and the parameters are
>  passed invisibly via POST request.
>
>  Is there a way to do that?
>
>  ~Dan Allen
>
>
>
>  [1]
>  <action name="createPolicy" class="createPolicyAction">
>         <result name="success" type="redirect-action">
>                 <param name="actionName">documentUpload_input</param>
>                 <param name="parse">true</param>
>                 <param name="policyId">${policyId}</param>
>         </result>
>  </action>

-- 
This message may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived by any transmission to an unintended recipient. If you are not an intended recipient, please notify the sender and delete this message immediately. Any views expressed in this message are those of the sender, not those of any entity within the KBC Financial Products group of companies (together referred to as "KBC FP"). 

This message does not create any obligation, contractual or otherwise, on the part of KBC FP. It is not an offer (or solicitation of an offer) of, or a recommendation to buy or sell, any financial product. Any prices or other values included in this message are indicative only, and do not necessarily represent current market prices, prices at which KBC FP would enter into a transaction, or prices at which similar transactions may be carried on KBC FP's own books. The information contained in this message is provided "as is", without representations or warranties, express or implied, of any kind. Past performance is not indicative of future returns.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Redirect-action parameters via POST

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Can you put the info on the session?

Nils-H

On Thu, Apr 24, 2008 at 9:52 PM, Allen, Daniel <Da...@kbcfp.com> wrote:
> Hi, all.
>
>  I'm using the snippet below[1] in my struts.xml file to send finish an
>  action with a redirect to another, and sending a parameter along.
>  However, Struts 2 defaults to passing the parameter via appending it to
>  the URL in a GET request. I'm going to need to add additional
>  parameters, some of which may be extremely large, and which I'd prefer
>  the user not be able to easily alter. So, I would like to change things
>  so that the URL result is just
>  "webapp.com/namespace/documentUpload_input" and the parameters are
>  passed invisibly via POST request.
>
>  Is there a way to do that?
>
>  ~Dan Allen
>
>
>
>  [1]
>  <action name="createPolicy" class="createPolicyAction">
>         <result name="success" type="redirect-action">
>                 <param name="actionName">documentUpload_input</param>
>                 <param name="parse">true</param>
>                 <param name="policyId">${policyId}</param>
>         </result>
>  </action>
>
>  --
>  This message may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived by any transmission to an unintended recipient. If you are not an intended recipient, please notify the sender and delete this message immediately. Any views expressed in this message are those of the sender, not those of any entity within the KBC Financial Products group of companies (together referred to as "KBC FP").
>
>  This message does not create any obligation, contractual or otherwise, on the part of KBC FP. It is not an offer (or solicitation of an offer) of, or a recommendation to buy or sell, any financial product. Any prices or other values included in this message are indicative only, and do not necessarily represent current market prices, prices at which KBC FP would enter into a transaction, or prices at which similar transactions may be carried on KBC FP's own books. The information contained in this message is provided "as is", without representations or warranties, express or implied, of any kind. Past performance is not indicative of future returns.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org