Spring Security rename login form tags name

formsspring-security

I Spring Security Login form we have the following form

<form name='f' action='/j_spring_security_check' method='POST'> 
 <table> 
    <tr><td>User:</td><td><input type='text' name='j_username' value=''></td></tr> 
    <tr><td>Password:</td><td><input type='password' name='j_password'/></td></tr> 
    <tr><td colspan='2'><input name="submit" type="submit"/></td></tr> 
    <tr><td colspan='2'><input name="reset" type="reset"/></td></tr> 
  </table> 
</form>

I know how to modify action attribute on this form (using login-processing-url="/login")
My question is how can I change j_username & j_password tags names, to be username and password?

Best Answer

There is an alternative way for your request :
Spring - Security : how are login username and password bound to the authentication-provider?
Spring Security 3- How to customize username/password parameters?

But the best approach is update to Spring Security 3.1.0 (latest version is RC2, GA may release in few months from now), with the new configuration in form-login :

<beans:beans>
  <http>
    <form-login username-parameter="username" password-parameter="password" />
  </http>
</beans:beans>
Related Topic