一个实例
tomcat_home/conf/tomcat-users.xml:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="strutssample"/>
<role rolename="administrator"/>
<role rolename="manager"/>
<user username="yiyi735" password="2876254" roles="strutssample"/>
<user username="rolia" password="2876254" roles="administrator,strutssample,manager"/>
</tomcat-users>
web.xml:
<security-constraint>
<web-resource-collection>
<web-resource-name>adminFormPages</web-resource-name>
<url-pattern>/security/form/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>strutssample</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/security/form/security_login.jsp</form-login-page>
<form-error-page>/security/form/failure.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>strutssample</role-name>
评论