GeeCON Prague 2014*
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
Author

sendRedirect(" ");

Arun Vethadas .T
Ranch Hand

Joined: Dec 13, 2001
Posts: 36
Hai
i have one problem. IN my servlet one if condition where i using response.sendRedirect("filepath");it ask for full path like("http://3.50.20.12:8080/six/page3.jsp")
when i give response.sendRedirect("page3.jsp");
it is not working. i don't know why?
pls . help me.
Thanks,
Arun.
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.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Vikas Aggarwal
Ranch Hand

Joined: Jun 22, 2001
Posts: 140
Hi!
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 "http://3.50.20.12:8080/six/page3.jsp".
Please do check that the first page from which "Page3.jsp" is being refernced is under the path "http://3.50.20.12:8080/six/".


Vikas Aggarwal

Founder @
Leads and Deals Limited

www.LeadsAndDeals.com
Arun Vethadas .T
Ranch Hand

Joined: Dec 13, 2001
Posts: 36
Thank u verymuch
Arun.
 
GeeCON Prague 2014
 
subject: sendRedirect(" ");