I have some code where in certain cases I need to response.sendRedirect to another site.
The problem is...the response.sendRedirect is not immediate. In other words:
...the updateCount is still called bc the response.sendRedirect is not immediate.
If I have a "return" statement right after the response.sendRedirect my code won't compile because "This method must return a result of type ActionForward".
Sure...I could just move all the rest of the code in the page into an else block after the if statement, but isn't there a way to return immediately after the response.sendRedirect in struts?
Of course those statements are called. Your code is written in Java, and the rules of Java say that after one statement is completed, the next statement is executed. There aren't any exceptions for methods like sendRedirect.
So like David says, use a return statement. Or write an if-else statement to control what code is run.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: response.sendRedirect Immediately In Struts