title: response.sendRedirect() from jsp:include being ignored?
body: <p>I've got a jsp file, which includes another jsp file to check some values and such:</p>
  
  <p><code>&lt;jsp:include page="setup.jsp" /&gt;</code></p>
  
  <p>Inside the setup.jsp I've got some conditional code which determines if some needed values are set in the session and if not redirects them to a different page. Or at least it is supposed to, but the redirect seems to be getting ignored. </p>
  
  <pre><code>System.err.println("Redirecting!");
  response.sendRedirect("http://www.google.com");
  return;
  </code></pre>
  
  <p>I see "Redirecting!" get logged to the console, but the page continues on and renders normally. I had curl dump the headers for me and saw that the response is <code>HTTP/1.1 200 OK</code> so it definitely isn't sending a 302 redirect.</p>
  
  <p>Any idea what the problem is and how I can fix this?</p>
  
  <p>EDIT: I have verified that my response is not yet committed. <code>response.isCommitted()</code> returns <code>false</code> meaning the status code and headers have not been sent yet.</p>
  
  <p>EDIT 2: I've tried calling <code>response.sendRedirect()</code> in many other places and find that I can successfully redirect before the . The redirect inside the JSP seems to be ignored and if I try to redirect right AFTER the jsp then I get an illegal state exception because the response has already been committed.</p>