tomcat 错误页面html,如何处理tomcat默认错误页面

受够了Tomcat默认的那个错误页面

0818b9ca8b590ca3270a3433284dd417.png

还有就是报错页面一样的难看!~

ok分享一个方法:

1.首先准备一个漂亮的错误页面:404.html

您访问的页面不存在

/*reset及 clear*/

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, p, blockquote, table, th, td, embed, object, button {

margin:0;

padding:0;

font-size:12px;

color:#343434;

font-family:"宋体", Arial, Helvetica;

word-wrap:break-word;

}

fieldset, img, abbr {

border:0;

}

address, caption, cite, code, dfn, em, strong, th, var, i, b {

font-weight:normal;

font-style:normal;

}

ul, ol {

list-style:none;

}

a, a:link, a:visited, a:active {

text-decoration:none;

}

a:hover {

text-decoration:underline;

}

a:focus, input[type="text"]:focus, input[type="password"]:focus, textarea:focus {

outline:none;

}

.cl0, .cl5, .cl10, .cl15, .cl20 {

clear:both;

overflow:hidden;

font-size:0;

}

.cl0 {

height:0px;

}

.cl5 {

height:5px;

}

.cl10 {

height:10px;

}

.cl15 {

height:15px;

}

.cl20 {

height:20px;

}

.nav {

width:100%;

background:url(404/404navbg.jpg) repeat-x;

height:39px;

}

.wrap {

width:980px;

margin:0 auto;

}

.nav .wrap em {

color:#f5e2c2;

font: bold 16px/39px "宋体";

padding-left:40px;

}

.tl {

text-align:left;

}

.tc {

text-align:center;

}

.tr {

text-align:right;

}

.box {

border:1px solid #dedddd;

border-radius:3px;

}

/*颜色*/

.purity_red {

color:#f00;

}

.fred {

color:#b01f2e;

}

.fyellow {

color:#ead6b3;

}

/*字体大小*/

.fs12 {

font-size:12px;

}

.fs14 {

font-size:14px;

}

/*头部背景*/

html {

_background-attachment:fixed;

_background-image:url(nothing.txt);

}

body {

background:url(404/topbg.jpg) #fbfbfb repeat-x;

height:100%;

}

.yelangsembg {

background:url(404/headbackbg.jpg) no-repeat center top;

padding-top:0px;

}

/*正文*/

.w7 {

width:770px;

margin:0 auto;

}

.w7 span {

display:inline-block;

height:170px;

margin-left:60px;

}

.w7 h1 {

color:#a21e2c;

font-size:26px;

font-family:"微软雅黑";

}

.w7 h2 {

color:#666;

font: bold 16px "宋体";

margin:10px 0;

}

.w7 h3 {

color:#666;

font: bold 14px "宋体";

margin:10px 0;

}

.w7 h3 em {

font-size:22px;

color:#aa2230;

padding:0 5px;

font-weight:bold;

}

.w7 span p a {

font: bold 14px/32px "新宋体";

color:;

display:inline-block;

background:url(404/404bt.jpg) no-repeat;

text-align:center;

width:106px;

height:32px;

margin-left:20px;

}

function returnHistory(){

window.history.go(-1);

}

404.gif

抱歉,您请求的页面现在暂时无法打开

您可以:

返回首页返回上一级

本页面将在4秒钟后自动转到首页,请稍后...

(function(){

var timeout = 0;

var handler = function(i){

document.getElementById("timeout").innerHTML = (10 - i);

if(i < 10)

{

var method = arguments.callee;

setTimeout(function(){method(i + 1);}, 1000);

}

else

{

document.location="http://localhost:8080/SinoWIFI/";

}

};

handler(0);

})();

404.gif图片:

0818b9ca8b590ca3270a3433284dd417.png

在web.xml中添加配置:

java.lang.Exception

/404.html

404

/404.html

400

/404.html

500

/404.html

ok,现在我们可以测试一下,在项目这个中随便输入地址:

0818b9ca8b590ca3270a3433284dd417.png

方便快捷!~包教包会!~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值