File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes sendRedirect( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "sendRedirect(" ");" Watch "sendRedirect(" ");" New topic

sendRedirect(" ");

Arun Vethadas .T
Ranch Hand

Joined: Dec 13, 2001
Posts: 36
i have one problem. IN my servlet one if condition where i using response.sendRedirect("filepath");it ask for full path like("")
when i give response.sendRedirect("page3.jsp");
it is not working. i don't know why?
pls . help me.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
instead of send redirect whic send a response back to the client, you want to use the forward or include method of the RequestDispatcher object. Search this forum for those keywords.

So much trouble in the world -- Bob Marley
Vikas Aggarwal
Ranch Hand

Joined: Jun 22, 2001
Posts: 140
When you use sendRedirect() or forward() they expect to have the relative virual URL. If the first page and the coming page are have the same virtual dirctory , you don't need to give the full path. But if they don't then you need to give path like "".
Please do check that the first page from which "Page3.jsp" is being refernced is under the path "".

Vikas Aggarwal

Founder @
Leads and Deals Limited
Arun Vethadas .T
Ranch Hand

Joined: Dec 13, 2001
Posts: 36
Thank u verymuch
I agree. Here's the link:
subject: sendRedirect(" ");
Similar Threads
Sending data to popup window
Javascript-- how to find referrer when url redirect is done
Issue with passing data from one jsp to another using sendRedirect method
Display messesge wait during background processing
Illegal State Exception