链接损坏重定向到自己设计的404错误页面
2013-12-04 15:46
176 查看
不存在的链接重定向到自己设计的404错误页面
在web.xml文件加入:
<error-page>
<error-code>403</error-code>
<location>/error/403</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/error/404.jsp</location>
</error-page>
自己设计的404错误页面:
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>页面找不到</title>
<style>
body {
background-color: #f9f9f9;
font-size: 14px;
}
h1 {
font-size: 20px;
font-weight: bold;
margin: 0 0 20px;
padding: 0;
color: #444;
}
a {
color: #428bca;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.container {
width: 500px;
margin: 60px auto;
background: #fff;
border: 1px solid #ddd;
}
.content {
padding: 40px;
}
.message {
margin-bottom: 20px;
color: #666;
line-height: 24px;
}
.actions a {
margin-right: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
<h1>页面找不到</h1>
<div class="message">该页面已被删除,或地址错误。</div>
<div class="actions">
<a href="/index">返回首页</a>
</div>
</div>
</div>
</body>
</html>
文件位置图:
在web.xml文件加入:
<error-page>
<error-code>403</error-code>
<location>/error/403</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/error/404.jsp</location>
</error-page>
自己设计的404错误页面:
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>页面找不到</title>
<style>
body {
background-color: #f9f9f9;
font-size: 14px;
}
h1 {
font-size: 20px;
font-weight: bold;
margin: 0 0 20px;
padding: 0;
color: #444;
}
a {
color: #428bca;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.container {
width: 500px;
margin: 60px auto;
background: #fff;
border: 1px solid #ddd;
}
.content {
padding: 40px;
}
.message {
margin-bottom: 20px;
color: #666;
line-height: 24px;
}
.actions a {
margin-right: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
<h1>页面找不到</h1>
<div class="message">该页面已被删除,或地址错误。</div>
<div class="actions">
<a href="/index">返回首页</a>
</div>
</div>
</div>
</body>
</html>
文件位置图:
相关文章推荐
- 链接损坏重定向到自己设计的404错误页面
- php防盗链,php ci在control里面控制除了自己站内的链接点击跳转,其他来源的都跳到站内页面
- MAC下安装mysql并使用java链接进行增删改查操作(帮助自己记忆)
- VC超级链接的设计与实现 (通过CHyperLinker类来实现)
- 一步一步教你在 Android 里创建自己的账号系统(二)--同步数据以及设计账号页面
- 设计模式 State模式 机器的情况下用自己的主动性
- 大数据算法设计模式(2) - 左外链接(leftOuterJoin) spark实现
- 设计一个类时应该问自己四个问题
- 糟糕!此链接好像已损坏
- 设计文章链接
- 根据业务自己设计的.NET工厂模式架构
- 自己动手设计 PHP MVC 框架(一)——URL (转载)
- 转录自己之前的一些关于PADS PCB设计技巧
- 你设计过自己的财富成长吗?(转)
- 零缺陷编程读书笔记(七)自己设计并使用断言(5)
- C语言和设计模式(之单件模式)【文章都是来自网络,只要自己吸取了就是自己的】 .
- C语言和设计模式(访问者模式) 【文章都是来自网络,只要自己吸取了就是自己的】
- C语言下的创建一个数组, 实现函数init()初始化数组、 实现empty()清空数组、 实现reverse()函数完成数组元素的逆置。 要求:自己设计函数的参数,返回值。
- 自己设计的atoi函数
- PHP 杂谈《重构-改善既有代码的设计》之五 简化函数调用【链接:http://www.cnblogs.com/baochuan/archive/2012/04/10/2437688.html】