[JAVA]web.xml配置404,500
javaWeb项目中,配置404,500,简简单单几句话就解决了。
web.xml
<error-page>
    <error-code>404</error-code>
    <location>/404.jsp</location>
</error-page>
<error-page>
    <error-code>500</error-code>
    <location>/505.jsp</location>
</error-page>
同时我的404.jsp直接接入腾讯公益的404页面。
腾讯404公益平台:http://www.qq.com/404/。
404.jsp
<%--
  Created by IntelliJ IDEA.
  User: 小信
  Date: 2018/9/10
  Time: 15:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isErrorPage="true"%>
<html>
<script type="text/javascript" src="//qzonestyle.gtimg.cn/qzone/hybrid/app/404/search_children.js" charset="utf-8"
        homePageUrl="/index.jsp" homePageName="重新回到主页">
</script>
<head>
    <title>发生了错误</title>
</head>
<body>
</body>
</html>
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 xiaoxin1218@qq.com
文章标题:[JAVA]web.xml配置404,500
文章字数:204
本文作者:周信
发布时间:2019-10-21, 19:14:56
最后更新:2023-05-03, 10:25:35
原始链接:http://zx21.xyz/2019/10/21/JAVA-web-xml配置404-500/版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。
 
            