title: Servlet Redirect Only After Clicking JavaScript Alert Message
body: <p>I am trying to redirect my servlet to some page only after clicking JavaScript alert message but its redirecting to the page without showing the alert message.</p>
  
  <pre><code>if(!rs.next()){
  
  out.println("&lt;script&gt;confirm('Record Not Found!');&lt;/script&gt;");
  request.getRequestDispatcher("SearchDriver.jsp").forward(request, response);
  
  }
  </code></pre>