Я хочу, чтобы аутентификация контролировалась Tomcat.Чтобы проверить это, я создал простые страницы, страницу входа и страницу loginError.Казалось, аутентификация работает.Когда я ввожу неправильный логин или пароль, я вижу страницу loginError.Но при вводе правильного логина и пароля я вижу:
type Status report
message Access to the requested resource has been denied
description Access to the specified resource (Access to the requested resource has been denied) has been forbidden.
Вот мой web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<security-constraint>
<web-resource-collection>
<url-pattern>/protected.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/loginError.jsp</form-error-page>
</form-login-config>
</login-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Вот мой tomcat-users.xml
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="admin"/>
<role rolename="manager"/>
<user password="tomcat" roles="tomcat,manager,admin" username="tomcat"/>
<user password="proger" roles="tomcat" username="proger"/>
</tomcat-users>
Мой login.jsp выглядит так:
<html>
<body>
<form id="loginForm" method="post" action="j_security_check">
<p>
Username: <input type="text" name="j_username" id="j_username" />
<br/>
Password: <input type="password" name="j_password" id="j_password" />
<br/>
<button type="submit">login</button>
</p>
</form>
</body>
</html>
Я развертываю его, использую NetBeans 6.9.1.Я использую Tomcat 6.0.29.Что может быть не так?Заранее спасибо.