The moose likes Servlets and the fly likes redirecting page in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "redirecting page in JSP" Watch "redirecting page in JSP" New topic
Author

redirecting page in JSP

Arunagiri, Shanmugham
Ranch Hand

Joined: Jan 23, 2001
Posts: 46
I want to redirect from a jsp page to another url after checking for the parameter from request object.
When i use the command response.sendRedirect("http://..."), the next page displays,
the document has been moved to http://.... instead of showing that page.
What is the reason for this?
Arun

Sun Certified Programmer for Java2 Platform
Bharatesh H Kakamari
Ranch Hand

Joined: Nov 09, 2000
Posts: 198
What you hv mentioned is not very clear.
Try using <jsp:forward> tag.
Or post your code here ... for better understanding of problem.
Arunagiri, Shanmugham
Ranch Hand

Joined: Jan 23, 2001
Posts: 46
Hi Bharatesh,
This is my code
<% if((request.getParameter("submit")).equals("Modify")){
response.sendRedirect("http://www.seeconsulting.com/jsp/CompDisp.jsp"}%>
Arun
Bharatesh H Kakamari
Ranch Hand

Joined: Nov 09, 2000
Posts: 198
I just modified your code as follows :

Basically i just modified the method name.
I am not sure if this was what your problem ?
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Heh
What I think you may be running into is the following:
If the 307 status code [Temporary Redirect -- PdH] is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued. -- RFC 2616, HTTP 1.1 protocol specification, section 10.3.8.
From the looks of the code snippet you gave, the request might have been a POST. In that case the fix may be as simple as either changing your form to use the GET method, or replace the redirect by a forward (if possible).
Not entirely sure, but...
have fun,
- Peter

[This message has been edited by Peter den Haan (edited March 07, 2001).]
 
 
subject: redirecting page in JSP
 
Threads others viewed
Tomcat: page not found
PostBack ?
how to send cookie from one jsp page to another jsp page or to servlet
How to display Welcome JSP Page for a Web Application
forwarding to jsp
IntelliJ Java IDE