tomcat中基于表单的验证

04-01-29 wwlhp@jdon

我在tomcat中建立了一个用户,角色跟admin用户相同。
登陆页面login.jsp,代码如下:


<form method="post" action="j_security_check">
<table border="0">
<tr>
<td align="center" colspan="2"> Welcome! Please enter your name <br> and password to log in. </td>
</tr>
<tr>
<td align="right"> Name: </td>
<td> <input type="text" name="j_username" value="" size="15"> </td>
</tr>
<tr>
<td align="right"> Password: </td>
<td> <input type="password" name="j_password" value="" size="6"> </td>
</tr>
<tr>
<td align="center" colspan="2"> <input type="submit" value=" OK "> </td>
</tr>
</table>
</form>


web.xml文件内容如下:


<login-config>
<auth-method> FORM </auth-method>
<form-login-config>
<form-login-page> /login.jsp </form-login-page>
<form-error-page> /login_error.jsp </form-error-page>
</form-login-config>
</login-config>

<!-- 安全角色 -->
<security-role>
<role-name> admin </role-name>
</security-role>


运行的时候抛出错误,请问这是怎么回事,多谢帮助!

HTTP Status 404 - /tagOpt/j_security_check

--------------------------------------------------------------------------------

type Status report

message /tagOpt/j_security_check

description The requested resource (/tagOpt/j_security_check) is not available.

rypan
2004-01-30 09:19

没在server.xml中配MemoryRealm

wwlhp@jdon
2004-01-30 11:19

能告诉我具体怎么配么? 谢谢了!

agilejava
2004-01-30 13:41

server.xml中有例子的,可能是被注释掉了

wwlhp@jdon
2004-01-30 14:18

原来是
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>
我把它注释掉了,改为
<Realm className="org.apache.catalina.realm.MemoryRealm"/>
可是还不行,HTTP Status 404 - /tagOpt/j_security_check。

2Go 1 2 下一页