You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "St-Pierre, Alain" <al...@cgi.com> on 2006/02/23 17:51:08 UTC
Redirect with a POST instead of a GET
Is there a built-in mechanism in Struts which allows a Redirect with an
HTTP POST method instead of GET method?
Here is my requirement:
I have two separate Application servers. The server A will host my html
form.
When I submit my form, I want to go in an Action class of my server A,
which will prepare a new form (different one), to be sent out to server
B.
In order to pass over the control the server B, from now on, which will
response to the browser, to render the end result.
Here is a sequence diagram to make it clearer:
Browser Server A
Server B
----------------post------------->
>--prepare new form--<
<--------------redirect----------
--------------------------------------------------------------------new
form---->
<-------http response
(rendering)-----------------------------------------
My question is:
How can I create a new FORM to be POSTed, from Struts, and REDIRECT it
to the browser?
The browser will, for sure have to sent that new form to the other
server.
Alain
Re: Redirect with a POST instead of a GET
Posted by Michael Jouravlev <jm...@gmail.com>.
On 2/23/06, St-Pierre, Alain <al...@cgi.com> wrote:
> Here is my requirement:
>
> I have two separate Application servers. The server A will host my html
> form.
>
> When I submit my form, I want to go in an Action class of my server A,
> which will prepare a new form (different one), to be sent out to server
> B.
Why would not you call B from A, then get response and send it back to
browser, so that browser would not even know about B existance?
> The browser will, for sure have to sent that new form to the
> other server.
Is this a requirement?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Redirect with a POST instead of a GET
Posted by Neil Erdwien <ne...@k-state.edu>.
I don't think you want an HTTP redirect at all. I would include, on the
second form (the one created by A to be posted to B), client-side
JavaScript that does the form submission when the page is loaded.
If there is any chance that JavaScript wouldn't be available, you could
include static HTML on the page that says something to the effect of
"Your transaction is in process. Select the continue button to complete
the process". Then have the "continue" button be the form submission.
Another possibility would be to have A contact B for the client, and
relay the response.
Michael Jouravlev wrote:
> On 2/23/06, St-Pierre, Alain <al...@cgi.com> wrote:
>> Is there a built-in mechanism in Struts which allows a Redirect with an
>> HTTP POST method instead of GET method?
>
> Use HTTP response code 307. If browser supports it correctly, a user
> has to confirm redirection. Many browsers do not support this response
> code at all.
>
> See: http://ppewww.ph.gla.ac.uk/~flavell/www/post-redirect.html
>
> Michael.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Neil Erdwien, neil@k-state.edu, Web Technologies Manager
Computing and Network Services, Kansas State University
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Redirect with a POST instead of a GET
Posted by Michael Jouravlev <jm...@gmail.com>.
On 2/23/06, St-Pierre, Alain <al...@cgi.com> wrote:
> Is there a built-in mechanism in Struts which allows a Redirect with an
> HTTP POST method instead of GET method?
Use HTTP response code 307. If browser supports it correctly, a user
has to confirm redirection. Many browsers do not support this response
code at all.
See: http://ppewww.ph.gla.ac.uk/~flavell/www/post-redirect.html
Michael.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org