0
爲Tomcat j_security_check快速的問題...Tomcat的j_security_check用戶ID
任何人都知道如何在user_role的表更改「USER_NAME」的「身份證」,我寧願 驗證通過匹配了ID比用戶名
server.xml中
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost/test"
connectionName="root" connectionPassword="password"
userTable="user" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_role_link" roleNameCol="role_id" />
表
user
id INT PK
user_name PK
user_pass
role
id INT PK
role_name
user_role
user_id FK user_id to user.id
role_id FK role_id to role.id
形式仍然是:
<form method="post" action="j_security_check" name="loginForm">
<j:if test='${not empty param["failed"]}'>
Invalid sign-in credentials<br/>
</j:if>
<h:inputText id="j_username" autocomplete="off" />
<br/>
<h:inputSecret id="j_password" autocomplete="off"/>
<br/>
<h:commandButton type="reset" value="Clear"/>
<h:commandButton type="submit" value="Login"/>
</form>
我已經得到了ROLE_ID工作,但與USER_ID我只是得到一個
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'user_name' in 'where clause'
例外
在此先感謝
KPS
用'userNameCol =「id」'替換'userNameCol =「user_name」'? – 2013-03-24 12:20:26
我想過,但只是得到相同的403訪問被拒絕&例外,但'id'而不是user_name。 – Casper 2013-03-24 13:00:46