500 拦截错误输出

<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

<html  class="error_page">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Error Page - error</title>
        <!-- Bootstrap framework -->
            <link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrap/css/bootstrap.min.css" />
            <link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrap/css/bootstrap-responsive.min.css" />
        <!-- main styles -->
            <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" />
            <script src="${pageContext.request.contextPath}/js/jquery-1.8.3.min.js"></script>
            
            
    </head>
    <body>

        <div class="error_box">
            <h1>error</h1>
            <p>内部服务器错误.</p>
            <a href="javascript:history.back()" class="back_link btn btn-small">返回</a>
            <a href="javascript:showError();" class="btn btn-small">信息</a><br>
            
            <div id="showError" style="display: none">
            <h3>错误码: </h3> <%=request.getAttribute("javax.servlet.error.status_code")%> <br> 
             <h3>信息     :</h3> <%=request.getAttribute("javax.servlet.error.message")%> <br> 
             <h3>异常     :</h3> <%=request.getAttribute("javax.servlet.error.exception_type")%> <br> 
            </div> 

        </div>

        <script type="text/javascript">
            function showError(){
                $("#showError").toggle();
            }
        </script>
        
    </body>
</html>

 

posted @ 2014-08-07 12:20  七郎  Views(463)  Comments(0Edit  收藏  举报