This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes sendRedirect does not execute. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "sendRedirect does not execute." Watch "sendRedirect does not execute." New topic
Author

sendRedirect does not execute.

youngsun lee
Greenhorn

Joined: Sep 26, 2003
Posts: 4
To redirect jsp page, i use 'response.sendRedirect(url)'. but this method does not execute. (beside i couldn't meet any excetions.)
i think it may be happened because of using multipart/form-data encoding.

is any help?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

if you are using multipart in the request, you should still be able to use sendRedirect in the response. Is there any possibility that another JSP may be getting included or forwarded to before the call to sendRedirect? An exception could also cause a forward, but you already said you aren't getting any.

Any chance of looking at a code snippet? (only paste the required code, not all of it, and please use UBB code tags)

Dave
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
you need to explicitly return from the service method after the sendRedirect else the redirect will only take effect after the service method has run to completion (which of course may cause a redirect or forward somewhere else replacing the one you want).


42
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: sendRedirect does not execute.
 
Similar Threads
Ant compiles IDL????
Statement Error
Statement Error
Struts Exception handling
To execute java application from jsp or applet