1.创建管理账号,默认账号没有manager角色
修改tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="admin" password="admin" roles="manager"/>
<user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>
2.让编辑后的代码生效
http://localhost/manager/html/reload?path=/servlets-examples
3.想查看堆栈调用
throw new ServletException("hi");
这样会直接在网页上打印出堆栈调用。