(1)%CATALINA_HOME%\conf\web.xml中web-app节点中添加

<error-page> 
    <error-code>404</error-code> 
    <location>/404.html</location> 
</error-page>

在 webapps 下 ROOT 新增 404.html 页面

<html lang="en">
  <head>
    <title>No Page</title>
  </head>
  <body>
    <p>No Page</p>
  </body>
</html>


自定义默认访问页

还是那个猫,如何访问localhost:8080 不出现那只猫的欢迎页的,同样,在conf/server.xml文件中设置,其中,welcome-file按顺序加载,在此处放入你想默认加载的页面即可,base.html是我想默认加载的文件替换了原来的index.jsp文件

<welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
    welcome-file>base.html</welcome-file>
    </welcome-file-list>