Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Forwarding a request to a different domain

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 9257
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is, in fact, a Struts question -- I misposted to the wrong forum. Thanks in advance for moving it, - Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic