[Logo]
Forums Register Login
Forwarding a request to a different domain
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
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.
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?

-
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.
This is, in fact, a Struts question -- I misposted to the wrong forum. Thanks in advance for moving it, - Dave
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Dec 14, 2017 15:57:11.