struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Lionel SMETS (prof)" <>
Subject Re: [S1] Best practice to transfer control to next page (out of JVM)?
Date Tue, 07 May 2013 15:28:18 GMT

I am writting some sort of a proxy & uses HttpClient to execute the request.
The HttpClient does the request (POST) as expected & I can see that the
answer is coming.
I just need to copy the HttpResponse received as the Struts "full" response.

This prooved to be more challenging than expected as the simple copy of
the whole reponse is currently NOT OK.

I stored the whole HTML-response in the variable content :
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:property value="content" />
does not fill the page with the HTML-content retrieve from the other request

and writing directly on the Struts response :

Any idea would be appreciated ... as it is basically copying an HTML
content from one to the other !!!



Subject: 	Re: [S1] Best practice to transfer control to next page (out
of JVM)? <> 	permalink
From: 	Frank W. Zammetti
Date: 	Jan 22, 2008 8:10:54 am
List: 	org.apache.struts.user

On Tue, January 22, 2008 10:56 am, enthucoder wrote:

Can you give some pointers on how do i contruct a HTTP POST Message in
my Action and redirect the page to remote resource (non J2EE App)..?

You wouldn't, in all probability, want to construct your own HTTP
requests... take a look at HTTP Components (formerly Jakarta Commons

It should provide everything you need without you having to mess with
all the gory details.


-- Frank W. Zammetti Author of "Practical DWR 2 Projects" (2008, Apress,
ISBN 1-59059-941-1) and "JavaScript, DOM Scripting and Ajax Projects"
(2007, Apress, ISBN 1-59059-816-4) and "Practical Ajax Projects With
Java Technology" (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - Supplying the wheel, so you don't
have to reinvent it!

Laurie Harper wrote:

enthucoder wrote:


Please bear with me, incase this turns out to be a dumb question.

I want to transfer control to a non JSP page after I hit submit. Apart
from this I am also sending some data as a HTTPS POST. In case of using
response.sendRedirect(), it doesn't take care of the POST data.

So, can anybody help me with what's the best practice in sending POST
request from a Struts based J2EE application to another page (which is
not a J2EE Application)

I'm not sure I'm clear on what you want to accomplish. If you want to
post a form to a page at a different URL outside your application, just
use that URL as the form's action. Your Struts application needn't be
involved at all.

If the intention is to submit a form and have it processed by *both*
your Struts app *and* an external resource, things are a little
trickier. In that case, your Struts action would have to construct a new
HTTP POST request using the request parameters it received from the
browser. Your action would then handle sending the request to the remote
resource (and streaming the response back to the browser if required),
acting as a kind of pseudo-proxy.

Perhaps you could explain what your overall objective is; perhaps this
isn't the right approach to take to the problem.


--------------------------------------------------------------------- To
unsubscribe, e-mail: For additional commands,

-- View this message in context:
Sent from the Struts - User mailing list archive at

--------------------------------------------------------------------- To
unsubscribe, e-mail: For additional commands,

--------------------------------------------------------------------- To
unsubscribe, e-mail: For additional commands,

Thomas Lionel SMETS, CISSP (385434)
*m :* +32 497 44 68 12
*ph :* +32 2 852 3341
*skype :* thomas.lionel.smets

PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10

View raw message