Maybe a dumb question but is there a way to redirect/forward a form (and all it's parameters) to another host using jsp? Like this http://www.xxx.com/form.jsp -> http://www.xxx.com/redirect.jsp -> http://www.yyy.com/response.jsp

I've tried with sendRedirect which doesn't pass along the parameters and forward that for some reason doesn't seem to work with an external host.

Thanks,
tte

Recommended Answers

All 4 Replies

redirect works, forward won't work.

But of course the HTTP session does NOT get shared.
And quite possibly you'll need to make sure you're working with POST requests so and change the request parameters to request attributes.

Remember that nothing except what ends up in the http request gets send across.

Forward won't work given that the requested servlet is looked for in the given ServletContext. sendRedirect doesn't preserve the original request since it's a new request altogether which the client is making -- sendRedirect is basically an indication to the client to request for the given URI.

why don't you sessions then if really want to use send.redirect option otherwise you can use form action method in using html that work fine with jsp

commented: giving bad advice that's already told to be bad is not a good idea -3

idiot. Sessions do NOT get shared between applications.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.