title: Form Based Authentication - Redirect to error page after successful authentication (Tomcat 7.0.4)
body: <p>I'm trying out form-based authentication, but I couldn't figure out why, after entering the correct user/password on the login page, it would redirect me to the error page instead of <code>index.jsp</code>.</p>
  
  <p>When I type:</p>
  
  <pre><code>http://localhost:8080/&lt;context&gt;/secure/index.jsp
  </code></pre>
  
  <p>I get the login page. However, when I type user/password (manager/manager), it brings me to the <code>error.html</code> instead of <code>index.jsp</code>.    </p>
  
  <p><strong>WEB.XML:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt;
  &lt;display-name&gt;FormBasedAuthentication&lt;/display-name&gt;
  &lt;login-config&gt;
      &lt;auth-method&gt;FORM&lt;/auth-method&gt;
      &lt;form-login-config&gt;
          &lt;form-login-page&gt;/login.html&lt;/form-login-page&gt;
          &lt;form-error-page&gt;/error.html&lt;/form-error-page&gt;
      &lt;/form-login-config&gt;
  &lt;/login-config&gt;
  &lt;security-role&gt;
      &lt;role-name&gt;role1&lt;/role-name&gt;
  &lt;/security-role&gt;    
  &lt;security-constraint&gt;
      &lt;web-resource-collection&gt;
          &lt;web-resource-name&gt;SecurePages&lt;/web-resource-name&gt;
          &lt;description&gt;Security constraint for JSP resources&lt;/description&gt;
          &lt;url-pattern&gt;/secure/*&lt;/url-pattern&gt;
          &lt;http-method&gt;POST&lt;/http-method&gt;
          &lt;http-method&gt;GET&lt;/http-method&gt;
      &lt;/web-resource-collection&gt;
      &lt;auth-constraint&gt;
          &lt;role-name&gt;role1&lt;/role-name&gt;
      &lt;/auth-constraint&gt;
      &lt;user-data-constraint&gt;
          &lt;transport-guarantee&gt;NONE&lt;/transport-guarantee&gt;
      &lt;/user-data-constraint&gt;
  &lt;/security-constraint&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>TOMCAT-USER.XML:</strong></p>
  
  <pre><code>&lt;tomcat-users&gt;
     &lt;role rolename="manager-gui"/&gt;
     &lt;role rolename="manager-script"/&gt;
     &lt;role rolename="manager-status"/&gt;
     &lt;role rolename="manager-jmx"/&gt;
     &lt;role rolename="role1"/&gt;
     &lt;user username="manager" password="manager" roles="role1"/&gt;
  &lt;/tomcat-users&gt;
  </code></pre>