title: How to redirect and show error message without using session in jsp?
body: <p>I have a form:  </p>
  
  <pre><code>&lt;form action="login" method="post" name="loginForm"&gt;
      User Name: &lt;input type="text" name="userName" autofocus&gt;
      Password: &lt;input type="password" name="pwd"&gt;
      &lt;input type="submit" value="Login"&gt;
      &lt;a href="register.jsp"&gt;Register&lt;/a&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Now whenever I hit submit button it will show /login in the address bar. I want to it to show /index.jsp with an error message if user or password do not match.
  I used sendRedirect method but how to send the error message? If i have to use session then I must remove the attribute too. What if I do not want to use session and still want to send the error message? How can I achieve that? </p>