wood burning stoves 2.0*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Java Strangeness...

Scott Batchelor
Greenhorn

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 {
response.sendRedirect(url);
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.
Scott
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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
Greenhorn

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);
return;
}
So it does hit a return but really doesnt do anything.
Thanks in advance.
SB
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61063
    
  66

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?).
thanks,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: Java Strangeness...