404页面与500页面

404页面与500页面_第1张图片

404页面:莫鸡冻,只是页面找不到,但是我们提供的源码,只要关注我们是能找到的。
在web.xml中配置:

<error-page>
    <error-code>404error-code>
    <location>/404.jsplocation>
  error-page>
  <error-page>
    <error-code>500error-code>
    <location>/500.jsplocation>
  error-page>

404页面html代码: pintuer.css就不贴出了,需要加QQ490647751索取。


<html>
<head>
<meta charset="utf-8">
<title>404错误页面title>
<link href="/resource/css/pintuer.css" rel="stylesheet"/>
head>

<body>
<div class="container" style=" margin-top:8%;"> 
   <div class="panel margin-big-top">
      <div class="text-center">
         <br>
         <h2 class="padding-top"> <stong>404错误!抱歉您要找的页面不存在stong> h2>
         <div class=""> 
            <div class="float-left">
                <img src="http://7xqxjz.com1.z0.glb.clouddn.com/404/20160804ds-1.gif">
                <div class="alert"> 卧槽!页面不见了! div>
            div>
            <div class="float-right">
               <img src="http://7xqxjz.com1.z0.glb.clouddn.com/404/20160804ds-2.png" width="260"> 
            div>
          div>
          <div class="padding-big">
               <a href="index_home.do" class="button bg-yellow">返回首页a>
               
          div> 
      div> 
   div> 
div>
body>
html>

一个兼容PC和手机的500页面,并输出错误的提示,并有复制错误的提示和返回上一页的功能。页面无任何动画效果,你可以在这基础上加。本500网页只注重输出by zero等错误信息,并没有过多注意前端的样式,还请前端的大神们多多指教。
404页面与500页面_第2张图片

404页面与500页面_第3张图片

<%@ page language="java" contentType="text/html; charset=utf-8"  isErrorPage="true" pageEncoding="utf-8"%>
<%@ page import="java.io.*,java.util.*"%>
<%response.setStatus(HttpServletResponse.SC_OK);%> 

<html>
<head>
    <title>500title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="keywords" content=""/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="http://7xqxjz.com1.z0.glb.clouddn.com/404style.css" rel="stylesheet" type="text/css" media="all"/>
head>
<body>
<div class="wrap">
    <h1> h1>
    <div class="banner">
        
    div>
    <div class="page" >
        <h2>程序有点小情绪,请尽快联系管理员,并按返回'上一页'进行操作。h2>
       <div style="color:#000;font-size: 0.8em;font-family: '微软雅黑';text-align: left;margin: 0 auto;">
       <div class="remark">
        <p><span style="color:red">An exception was thrown:span><br><b><%=exception.getClass()%>:<%=exception.getMessage()%>b>p>
        <br>
<%
Enumeration<String> e = request.getHeaderNames();
String key;
while(e.hasMoreElements()){
  key = e.nextElement();
  System.out.println(key+"="+request.getHeader(key));
}
e = request.getAttributeNames();
while(e.hasMoreElements()){
  key = e.nextElement();
  System.out.println(key+"="+request.getAttribute(key));
}

e = request.getParameterNames();
while(e.hasMoreElements()){
  key = e.nextElement();
  System.out.println(key+"="+request.getParameter(key));
}
%>
请求地址: <%=request.getAttribute("javax.servlet.forward.request_uri") %><br>
<pre>
<%exception.printStackTrace();
      ByteArrayOutputStream ostr = new ByteArrayOutputStream();
      exception.printStackTrace(new PrintStream(ostr));
      out.print(ostr);
    %> 
pre>
<hr width=80%>
div>
<div style="text-align: center;">
<a class="copyNews" style="background:#000;color:#fff;width:80px;height:40px;border-radius:2px;line-height:40px;text-align: center;cursor: pointer;padding:5px 5px;">复制a>
<a href="javascript:history.go(-1)" style="background:#000;color:#fff;width:120px;height:40px;border-radius:2px;line-height:40px;text-align: center;cursor: pointer;padding:5px 5px;">返回上一页a>
div>
div> 
    div>
    <div class="footer" style="text-align:center;">
        2017 © 艳辉网
    div>
div>

<script type="text/javascript" src="http://7xqxjz.com1.z0.glb.clouddn.com/jquery.js">script>
<script type="text/javascript" src="http://7xqxjz.com1.z0.glb.clouddn.com/clipboard.min.js">script>
<script type="text/javascript" src="http://res.layui.com/lay/lib/layer/build/layer.js">script>
<script type="text/javascript">
$(".copyNews").click(function(){

    var clipboard = new Clipboard('.copyNews', {
        text: function() {

            return $('.remark').text();
        }
    });
    clipboard.on('success', function(e) {});
    clipboard.on('error', function(e) {});
    layer.msg("复制成功!");
})
script>
body>
html>

全CSDN的丰(好)色(se)博客,这里有书本看不到的Java技术,电影院禁播的电影,欢迎关注QQ群494808400

你可能感兴趣的:(java工具,web.xml,源码,404提示错误图片,500,艳辉网)