My application has a JSP, which uses scriplet code to redirect to a page based on some condition.
But what is happening is that, after the redirect code response.redirect(..)
, the below code is executing. I don't want to execute below code or load the JSP page, I just want to redirect immediately. See the below example and please let me know the solution.
<html>
<body>
<%
boolean condition = true;
if(condition)
response.sendRedirect("http://www.google.co.in");
System.out.println("I don't want to execute this code, I just want to redirect after above line");
%>
</body>
</html>