title: response.setheader("Refresh", "0") not working
body: <p>I am trying to refresh my webpage when user session has expired or the connection is not active. I tried a lot of codes but it didn't seem to work. The last code that I used is </p>
  
  <pre><code>if(session.getAttribute("connection") != null &amp;&amp; !session.getAttribute("connection").equals("")){
              conn = (DBConnection) session.getAttribute("connection");
              if(conn == null){
                      response.setContentType("text/html");
                      response.setHeader("Refresh", "3");
                      return;
                  }
              }else{
                  response.setContentType("text/html");
                  response.setHeader("Refresh", "3");
                  return;
              }
  </code></pre>
  
  <p>I also tried response.sendRedirect() and request.getrequestdispatcher.forward() but it didnt work as well. the servlet is being called by a javascript which expects a json object.</p>