wood burning stoves*
The moose likes Struts and the fly likes Forwarding a request to a different domain Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Forwarding a request to a different domain" Watch "Forwarding a request to a different domain" New topic
Author

Forwarding a request to a different domain

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi,

I'm using Struts 1. In my Action's execute method, how do I forward a request to a JSP on a different domain? I want to pass all the request parameter names and values to this new page, if possible.

Currently I have this in my execute method ...

return new ActionForward(redirect);

But I'm getting this error, "Cannot get request dispatcher for path https://mystuff-dev.myco.com/portal/customjsp/hhredirect.jsp".

Thanks for any thoughts, - Dave
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8994
    
    9

You can't forward a request to a different server. Forwarding is done within the scope of a single request, so the response has to be done from the same server that the request targeted. You will have to redirect, which will respond to the initial request and force the browser to make a second request of the new address.


[How To Ask Questions On JavaRanch]
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Redirecting would create a new request. I want to keep the parameters from my original request in tact. So is the only solution to create a new form whose action is the redirect and to include each of the parameters I want to preserve as hidden fields on the new page?

-
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18986
    
    8

You can redirect to a URL which has parameters. How you'd do that in Struts 1 I don't know, but then we aren't in the Struts forum. If this is actually a Struts question then just say so and a moderator will move it to the Struts forum.
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
This is, in fact, a Struts question -- I misposted to the wrong forum. Thanks in advance for moving it, - Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Forwarding a request to a different domain