2011-05-29 87 views
5

我弹簧安全登录表单我们有以下形式Spring Security重命名登录表单标签名称

<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> 

我知道如何修改此表单上的动作属性(使用login-processing-url="/login") 我的问题是如何更改j_username & j_password标签名称,为用户名和密码?

回答

10

没有为您的要求的另一种方式:
Spring - Security : how are login username and password bound to the authentication-provider?
Spring Security 3- How to customize username/password parameters?

但最好的办法是更新Spring Security 3.1.0(最新版本是RC2,GA可能在几个月内释放从现在起),与new configurationform-login

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