I want to redirect to another servlet from one servlet and I am using response.sendRedirect(url) method without sending params through query string. Can anybody tell me still how I am getting those parameters in second servlet using request.getParameter(). I am using weblogic8.1 sp5 and servlet2.3
Till the client doesn't get response, the request doesn't die (I mean, request will be same whether you are forwarding or redirecting it to other web resource) so you get the same parameters in all the web resources untill the request is responded.
Joined: May 22, 2006
If so, Then why RequestDispatcher is used, as we can get params if in the same session.
The sendRedirect method sends a 302 header to the browser which indicates that it should make a new request with the given URL. The only way to add parameters to that request is with query string parameters.
There is, however, a way that you can ask the browser to make the original request (with the original POST method and the original form parameters) to the new URL by setting the response code to 307 and setting the location manually:
I just tried this and it worked but FireFox created a popup warning to let me, the user, know that this site is trying to redirect the entire form to a new URL.
Hi Ben, thanks for your reply, But my question was without sending parameters thru query string or not setting response code as you said I am getting those params. Is this because of as - rathi said. Then why should one use Req. Dispatcher method.
Originally posted by Deepa More: Hi Ben, thanks for your reply, But my question was without sending parameters thru query string or not setting response code as you said I am getting those params. Is this because of as - rathi said. Then why should one use Req. Dispatcher method.
Thanks again for reply.
Check to see what status code Weblogic sends when you call sendRedirect. It could be that it's using 307. You can do this with the LiveHTTPHeaders plugin for FireFox.