title: spring security not working
body: <p>I am developing a struts2 + spring + tiles + hibernate + spring security application</p>
  
  <p>When I go to url /register I am correctly redirected to the login page,
  but on logging in with username and password specified in the bean configuration file,
  I am redirected back to the login page with url "login?error=true" which means that the login was unsuccessful as I have mentioned "authentication-failure-url="/login?error=true""</p>
  
  <p>I have configured form based login with the following configuration</p>
  
  <p>//web.xml</p>
  
  <pre><code>&lt;listener&gt;
  &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;context-param&gt; 
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; 
      &lt;param-value&gt;
      /WEB-INF/applicationContext.xml
      /WEB-INF/medic-security.xml 
      &lt;/param-value&gt; 
  &lt;/context-param&gt; 
  
  &lt;filter&gt; 
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; 
      &lt;filter-class&gt; 
          org.springframework.web.filter.DelegatingFilterProxy 
      &lt;/filter-class&gt; 
  &lt;/filter&gt; 
  
  &lt;filter-mapping&gt; 
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; 
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt; 
  &lt;/filter-mapping&gt;
  
  &lt;filter&gt;
  &lt;filter-name&gt;struts2&lt;/filter-name&gt;
  &lt;filter-class&gt;org.apache.struts2.dispatcher.FilterDispatcher&lt;/filter-class&gt;
  &lt;/filter&gt;
  
  &lt;filter-mapping&gt;
  &lt;filter-name&gt;struts2&lt;/filter-name&gt;
  &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>//medics-security.xml</p>
  
  <pre><code>&lt;http auto-config="true" access-denied-page="/error"&gt;
  &lt;intercept-url pattern="/" access="IS_AUTHENTICATED_ANONYMOUSLY"/&gt;
  &lt;intercept-url pattern="/register*" access="ROLE_USER" /&gt;
  &lt;intercept-url pattern="/messagePost*" access="ROLE_USER" /&gt; 
  &lt;intercept-url pattern="/messageDelete*" access="ROLE_ADMIN" /&gt; 
  &lt;form-login login-page="/login" authentication-failure-url="/login?error=true"/&gt; 
  &lt;remember-me/&gt;
  &lt;logout/&gt;
  
  &lt;/http&gt; 
  
  &lt;authentication-manager&gt; 
     &lt;authentication-provider&gt; 
        &lt;user-service&gt;
        &lt;user name="admin" password="secret" authorities="ROLE_USER"/&gt;
        &lt;/user-service&gt;   
     &lt;/authentication-provider&gt; 
  &lt;/authentication-manager&gt; 
  </code></pre>
  
  <p>//login.jsp</p>
  
  <pre><code>&lt;form action="j_spring_security_check"&gt; 
      &lt;label for="j_username"&gt;Username&lt;/label&gt;
  &lt;input type="text" name="j_username" id="j_username"/&gt;&lt;br/&gt; 
      &lt;label for="j_password"&gt;Password&lt;/label&gt;
  &lt;input type="password" name="j_password" id="j_password"/&gt;&lt;br/&gt; 
      &lt;input type='checkbox' name='_spring_security_remember_me'/&gt; Remember me&lt;br/&gt;   
      &lt;input type="submit" value="Login"/&gt;
  &lt;input type="reset" value="Reset"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>//struts.xml</p>
  
  <pre><code>&lt;package name="default" namespace="/" extends="struts-default"&gt;
      &lt;action name="login" class="com.medics.action.LoginAction"&gt;
      &lt;result name="SUCCESS" type="tiles"&gt;login&lt;/result&gt;
      &lt;/action&gt;
  
      &lt;action name="register" class="com.medics.action.RegisterAction"&gt;
      &lt;result name="SUCCESS"&gt;/Register.jsp&lt;/result&gt;
      &lt;/action&gt;
  &lt;/package&gt;
  </code></pre>
  
  <p>Action classes are doing nothing except returning "SUCCESS"</p>