This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 Java 8 in Action this week in the Java 8 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: 24168
    
  30

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: 60071
    
  65

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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Strangeness...
 
Similar Threads
How to tell navigator to redirect to another url with javascript
Redirecting the req to another server ?
submiting the output in same page
Java Strangeness...
How do you pass a string from servlet to jsp if jsp is on another server?