Hi,
I'm looking for a way of redirecting in jsp ...
I know I can use the following instruction:
<%
response.sendRedirect("errors/error_001.html"); //Just an example
%>
The problem is that before the browser redirects, the complete jsp code is executed ... that means if I have, for example, any action on my database after the redirect command, it get's executed, and then when all jsp processing completes, the redirection is made.
I need something that just flushes the response buffer AND stops ANY jsp processing right after the redirect command.
if after the redirection I put "return", like:
<html>
(...)
<%
if(...) {
response.sendRedirect("errors/error_001.html"); //Just an example
return;
}
out.println("Some text here");
%>
(...)
</html>
I receive the following error:
Any ideas appreciated ... I'm searching all around the web, but with no solution so far ...
Thanks.
I'm looking for a way of redirecting in jsp ...
I know I can use the following instruction:
<%
response.sendRedirect("errors/error_001.html"); //Just an example
%>
The problem is that before the browser redirects, the complete jsp code is executed ... that means if I have, for example, any action on my database after the redirect command, it get's executed, and then when all jsp processing completes, the redirection is made.
I need something that just flushes the response buffer AND stops ANY jsp processing right after the redirect command.
if after the redirection I put "return", like:
<html>
(...)
<%
if(...) {
response.sendRedirect("errors/error_001.html"); //Just an example
return;
}
out.println("Some text here");
%>
(...)
</html>
I receive the following error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 3 in the jsp file: /inc/GBL_Global.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 5.0\work\Catalina\localhost\porthos\org\apache\jsp\index_jsp.java:64: unreachable statement
out.println("Some text here");
^
1 error
Any ideas appreciated ... I'm searching all around the web, but with no solution so far ...
Thanks.