Quantcast
Channel: CSDN博客推荐文章
Viewing all articles
Browse latest Browse all 35570

java web工程—在web.xml下配置异常处理界面

$
0
0
1<?xml version="1.0" encoding="UTF-8"?>
 2<web-app version="2.4" 
 3    xmlns="http://java.sun.com/xml/ns/j2ee" 
 4    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 5    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
 6    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 7    
 8<error-page>
 9    <error-code>404</error-code>
10    <location>/notfound.jsp</location>
11</error-page>
12
13<error-page>
14    <error-code>500</error-code>
15    <location>/error.jsp</location>
16</error-page>
17    
18</web-app>

在一个java web工程里,当你在你的web.xml里配置了上述两个<error-page>后,只要页面出现404错误就会跳转到WebRoot下的notfound.jsp页面,同样出现500错误,就会跳转到error.jsp页面,而不是跳转到一个404的html错误页面。

有关跳到404或者500的html错误页面对一个网站的威胁,请看我的另一篇博文:JSP如何声明和使用错误处理页面

作者:li898445911a 发表于2013-4-21 10:41:34 原文链接
阅读:45 评论:0 查看评论

Viewing all articles
Browse latest Browse all 35570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>