Tomcat 自定义错误页面(例如404页面等等)

版权声明:最终解释权归属Hern、HernSong(hernsong)、苍鹭、www.hernsong.com所有! https://blog.csdn.net/qq_36761831/article/details/89414221

1、将自定义的错误页面放在Tomcat的webapps/ROOT目录下:

2、在Tomcat的conf/web.xml文件最后面增加如下配置:

<error-page> 
    <error-code>404</error-code> 
    <location>/错误页面,(/表示的是tomcat的webapps/root目录)</location> 
</error-page>
<error-page> 
    <error-code>500</error-code> 
    <location>/错误页面,(/表示的是tomcat的webapps/root目录)</location> 
</error-page>

猜你喜欢

转载自blog.csdn.net/qq_36761831/article/details/89414221