title: Form authentication with Tomcat
body: <p>I am trying to implement form based authentication with Tomcat.  All my secured servlets are mapped under mydomain/myapp.  I am able to secure this directory by following the basic tutorials and specifying the login and login_failed pages.</p>
  
  <p>My problem is that I want an unsecured mydomain/index.html that contains the username/password forms so that a visitor can login from there.  My best attempt so far doesn't work:</p>
  
  <pre><code>&lt;form method="POST" action="myapp/"&gt;
    Username: &lt;input type="text" name="j_username"&gt; &lt;br/&gt; 
    Password: &lt;input type="password" name="j_password"&gt;
    &lt;input type="submit" value="Login"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Any suggestions?</p>
  
  <p>Edit:  Authentication works in the sense that if you try to access mydomain/myapp you get redirected to a login page.  What I don't understand is how to allow the user to login without first attempting to access the protected pages.</p>