title: Want a servlet to run and change url if login failed
body: <p>I have created a Login page in JSP in which I have simply created a form that asks user for username and password and with the <code>post</code> method I called a servlet. Now if the login fails, I want to be redirected to the login page again. For that I can do 2 things: </p>
  
  <ol>
  <li>use <code>forward</code> method of request dispatcher, or </li>
  <li>use the <code>sendRedirect</code> method. </li>
  </ol>
  
  <p>In the first case, I go back to login page successfully, but the URL is still that of servlet (I don't know how and why) and in the second case, I got the login page as well, but this time the request object will be regenerated (a new one). I don't want a new request object. What can I do?</p>