---------------------------------------------------错误页面errorpage
在web中的配置
<!-- 注意:演示完成后要继续注释这里,免得影响后面的测试。
<error-page>
<error-code>404</error-code>
<location>/404.html</location>
</error-page>
<error-page>
<exception-type>java.lang.NullPointerException</exception-type>
<location>/nullException.html</location>
</error-page>
-->
-------------------------------------------------nullException.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-
8">
<title>nullException.html</title>
</head>
<body>
<center>
<font color="red">页面出错,请联系管理员进行处理。</font>
</center>
<!-- 下面使用空格占位置,否则浏览器不会转到此页面。 -->
</body>
</html>
-------------------------------------------------------------------404.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-
8">
<title>404.html</title>
</head>
<body>
<center>
<font color="red">您访问的资源没有找到,请联系管理员进行处
理。</font>
</center>
<!-- 下面使用空格占位置,否则浏览器不会转到此页面。 -->
</body>
</html>
测试访问一个没有的页面