File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Java Strangeness... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

Java Strangeness...

Scott Batchelor

Joined: Jul 07, 2003
Posts: 11
Ok here is a scenario I am seeing. I am debugging my app and I am using this block of code to do a redirect:
try {
LOG.debug("Redirect URL = " + url);
} catch (IOException e) {
When I step throught his code it actually hit the line: response.sendRedirect(url);
And the url variable is correct in the logs.
But it doesnt send the app anywhere just continues on.
Any thoughts.
I hope this isnt to vague but I am stumped as to what could be causing this.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

The app [servlet, yes?] "continues on" because you're allowing it to; you have to actually return from the method that calls sendRedirect() before the redirect happens.

[Jess in Action][AskingGoodQuestions]
Scott Batchelor

Joined: Jul 07, 2003
Posts: 11
I am sorry I should have been more clear. Here is the code that call the method to do the redirect.
if (blah, blah, blah){

this.redirectToPublicPeoplesoft(request, response);
So it does hit a return but really doesnt do anything.
Thanks in advance.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

This question was posted twice; accidentally I am sure. Please make any further comments on the other instance (and could a bartender close this one?).

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Java Strangeness...
jQuery in Action, 3rd edition