<web-app>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Security is active on entire directory -->
<security-constraint>
<display-name>Tomcat Server Form Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<description>A Page of Login Success</description>
<url-pattern>/ProtectedDirOne/index.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<!-- Anyone with one of the listed roles may access this area -->
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<!-- Login configuration uses form-based authentication -->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Tomcat Server Configuration Form-Based Authentication Area</realm-name>
<form-login-config>
<form-login-page>/login.jsp </form-login-page>
<form-error-page>/Error.htm </form-error-page>
</form-login-config>
</login-config>
<!-- Security roles referenced by this web application -->
<security-role>
<description>
The role is Administration
</description>
<role-name>admin</role-name>
</security-role>
</web-app>
(4)在C:/jakarta-tomcat-5.0.19/conf/tomcat-users.xml文件中配置admin的角色以及与该admin角色相匹配的用户名称和密码
(5)执行该页面
在浏览器中直接输入受保护的页面的URL地址:
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-27620-22.html
武器的火力强度