title: using redirection from servlet
body: <p>i am using a servlet to bring in a login page for my web application.but once i login and click on "submit" button,i should be redirected to another page. how do i do this? i am currently trying to use</p>
  
  <pre><code>RequestDispatcher rd = null;
  rd = getServletContext().getRequestDispatcher("/NextServlet");
  rd.forward(request, response);
  </code></pre>
  
  <p>Also tried using</p>
  
  <pre><code>response.sendRedirect("http://localhost:8080/myProject/NextServlet");
  </code></pre>
  
  <p>but nothing happens on click of submit, I do not want to include a link with href and use. What should I do?</p>