This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
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

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
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(" ");
jQuery in Action, 3rd edition