开发环境win2k+tomcat5.517+jdk1.50
在使用tomcat安全域的时候,比如我在<tomcat-home>/conf/tomcat-user.xml文件中,添加<role rolename="xkrlzy" description="具有访问人力资源admin目录中的权限"/>角色和用户<user username="xkrlzy" password="6688" fullName="人力资源管理员" roles="xkrlzy"/>的用户xkrlzy,然后再应用程序目录中有一个admin目录,该目录下的内容只能为用户xkrlzy这个用户使用,然后再修改应用的web.xml,添加以下的内容:
<security-constraint>
<display-name>Tomcat Server Configuration Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<!-- Define the context-rlative URL(s) to be protected -->
<url-pattern>admin/*.jsp</url-pattern>
<url-pattern>admin/*.html</url-pattern>
<url-pattern>admin/*.htm</url-pattern>
<url-pattern>admin/*.do</url-pattern>
</web-resource-collection>
<auth-constraint>
<!-- Anyone with one of the listed roles may access this area -->
<role-name>xkrlzy</role-name>
</auth-constraint>

</security-constraint>

<!-- Login Configuration uses form-based authentication area -->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Tomcat Server Form-Based Authentication Area</realm-name>
<form-login-config>
<form-login-page>/admin/login.jsp</form-login-page>
<form-error-page>/admin/error.jsp</form-error-page>
</form-login-config>
</login-config>

<security-role>
<description>The role that is required to log in to the Administrator Application</description>
<role-name>xkrlzy</role-name>
</security-role>
然后通过Http://localhost:8080/xkrlzy/admin/index.html
网页的提示为:你访问的目标资源不可见
如果把上面对的内容删除,则可以正常浏览;如果控制的为根目录下的内容则可以正常使用tomcat的安全域
我的问题是:如果只是控制根目录下的一个子目录使用tomcat的安全域应当如何做,比如这里只要admin目录使用tomcat的安全域,应当如何做,谢谢