servlet中实现验证、管理

	<servlet-mapping>
		<servlet-name>Hello</servlet-name>
		<url-pattern>/servlet/Hello</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>SalaryServer</servlet-name>
		<url-pattern>/servlet/SalaryServer</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>

	<security-constraint>
		<web-resource-collection>
			<web-resource-name>SecretProtection</web-resource-name>
			<url-pattern>/servlet/SalaryServer</url-pattern>
			<http-method>GET</http-method>
			<http-method>POST</http-method>
		</web-resource-collection>
		<auth-constraint>
			<role-name>manager</role-name>
			<role-name>engineer</role-name>
		</auth-constraint>
	</security-constraint>
	<login-config>
		<auth-method>BASIC</auth-method>
		<realm-name>Default</realm-name>
	</login-config>
	<security-role>
		<role-name>manager</role-name>
	</security-role>
	<security-role>
		<role-name>engineer</role-name>
	</security-role>

你可能感兴趣的:(xml,jsp,servlet)