K: / Tomcat/conf/tomcat-users.xml
XML Version = '1.0' Encoding = 'UTF-8'?> < User username = "tomcat" password = "Tomcat" roles = "tomcat" /> tomcat-users>
Web.xml
XML Version = "1.0" encoding = "UTF-8"?> / jsp / * url-pattern> web-resource-collection> < Role-name> manager role-name> auth-connection> security-constraint> Basic auth-method> login-config> web- app>
K: /TOMCAT/webapps/test9/jsp/AUTH.JSP
<% @ page contenttype = "text / html; charset = GBK"%>
YEAH, You Can See Me Now! h1>
Http: // localhost: 2000 / test9 / jsp / auth.jsp
Will jump out of a landing window, type user = bitan, password = bitan after display: Yeah, you can see me now!