jsp错误页面404、500等异常捕获
来源:互联网 发布:js排序算法 编辑:程序博客网 时间:2024/05/18 02:01
首先在web.xml中配置:
<error-page> <error-code>400</error-code> <location>/pages/common/exceptionError.jsp</location> </error-page> <error-page> <error-code>401</error-code> <location>/pages/common/exceptionError.jsp</location> </error-page> <error-page> <error-code>402</error-code> <location>/pages/common/exceptionError.jsp</location> </error-page> <error-page> <error-code>403</error-code> <location>/pages/common/exceptionError.jsp</location> </error-page> <error-page> <error-code>404</error-code> <location>/pages/common/exceptionError.jsp</location> </error-page> <error-page> <error-code>405</error-code> <location>/pages/common/exceptionError.jsp</location> </error-page> <error-page> <error-code>406</error-code> <location>/pages/common/exceptionError.jsp</location> </error-page> <error-page> <error-code>407</error-code> <location>/pages/common/exceptionError.jsp</location> </error-page> <error-page> <error-code>413</error-code> <location>/pages/common/exceptionError.jsp</location> </error-page> <error-page> <error-code>414</error-code> <location>/pages/common/exceptionError.jsp</location> </error-page> <error-page> <error-code>500</error-code> <location>/pages/common/exceptionError.jsp</location> </error-page> <error-page> <exception-type>java.lang.Exception</exception-type> <location>/pages/common/exceptionError.jsp</location></error-page>或者
<error-page><exception-type>javax.servlet.ServletException</exception-type><location>/pages/common/exceptionError.jsp </location></error-page>exceptionError.jsp页面内容:
<%@ 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"><meta http-equiv="X-UA-Compatible" content="IE=8" /><title>出错啦</title><script type="text/javascript">function refresh(){if(self.frameElement.tagName=="IFRAME"){// 页面在iframe中时处理parent.showErrorMsg('<h2 align="center" style="font-size: 18px; color: red; "> 程序异常,请联系管理员 <br></h2>');} }refresh();</script></head><body><input type="hidden" id="errorMsg" value="程序异常,请联系管理员"><div id="errorMsgDiv"><h2 align="center" style="font-size: 18px; color: red; ">程序异常,请联系管理员<br><br>错误码:<br><br></h2><h1 align="center" style="font-size: 60px; color: red;"><%=request.getAttribute("javax.servlet.error.status_code")%> <br></h1><br><br><h2 align="center" style="font-size: 18px; color: gray; ">信息: <%=request.getAttribute("javax.servlet.error.message")%> <br><br>异常: <%=request.getAttribute("javax.servlet.error.exception_type")%> <br><br></h2></div></body></html>
阅读全文
0 0
- jsp错误页面404、500等异常捕获
- 捕获页面的404,500等错误
- 捕获404,500等错误页面
- 捕获jsp页面500,404错误,页面不显示错误码
- jsp 捕获404页面
- 捕获500,404错误页面跳转
- #在一个文本框中输入“sdfsf”等内容,提交表单后,页面出现错误,不知怎样可以捕获这个异常?
- 自定义标签,实现整个jsp页面异常捕获。
- PHP自动捕获Exception,Fatal error等错误和异常
- 常见jsp出现的页面错误(404,500等)与捕捉办法
- 常见jsp出现的页面错误(404,500等)与捕捉办法
- 捕获参数错误异常
- 404,500等错误页面配置
- JSP的错误页面设置和页面跳转等
- JSP的错误页面设置和页面跳转等
- 页面捕获抛出的异常
- 配置404等错误页面
- 配置web404,500等异常页面
- YII框架中使用layer弹出层,注册js文件
- vs+halcon 打开摄像头失败
- Xposed插件的使用(一)进行简单的Hook
- PHP循环遍历数据库中表的字段并显示到前端
- hibernate 与 mybatis
- jsp错误页面404、500等异常捕获
- 链表的增、删、查、找
- 注册登录
- pdfelement 破解版V6.3.5.2806下载 | Wondershare PDFelement(PDF工具箱)官方中文版无需wondershare pdfelement 注册码
- python pip 安装opencv额外库SIFT+SURF等 (避免opencv_contrib + cmake)
- last Month
- 两个类具有相同的 XML 类型名称 "{http://service.webservice.base.xm/}searchAccountBatchResponse"。 请使用 @XmlType.na
- PHP的基础整理
- SPSS学习(1)之数据录入与数据获取