在web.xml中配置error-page

在web.xml中有两种配置error-page的方法,一是通过错误码来配置,而是通过异常的类型来配置,分别举例如下:

一.   通过错误码来配置error-page

<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>

上面配置了当系统发生500错误(即服务器内部错误)时,跳转到错误处理页面error.jsp。

二.   通过异常的类型配置error-page

Eg.

<error-page>
        <exception-type>java.lang.NullException</exception-type>
        <location>/error.jsp</location>
   </error-page>
上面配置了当系统发生java.lang.NullException(即空指针异常)时,跳转到错误处理页面error.jsp

在web.xml中配置error-page的更多相关文章

  1. web.xml 中配置了error-page但不起作用问题

    问题: 在web.xml 中配置了 error-page,但是好像不起作用,就是跳转不到指定的页面. 配置信息如下: <!-- 400错误 --> <error-page> & ...

  2. web.xml中配置log4j

    1.将 commons-logging.jar和 log4j.jar加入你的项目中:2.在src/下创建log4j.properties|log4j.xml文件:3.在web.xml中配置log4j的 ...

  3. web.xml中配置Spring中applicationContext.xml的方式

    2011-11-08 16:29 web.xml中配置Spring中applicationContext.xml的方式 使用web.xml方式加载Spring时,获取Spring applicatio ...

  4. struts2 在 Action 或 Interceptor 中获取 web.xml 中配置的 <context-param> 参数 (这是我的第一篇博文,哈哈。)

    最近为了改一个问题,想加一个控制开关,就在web.xml 中配置了一个 <context-param> 参数,并在 Action 或 Interceptor 中获取参数值. 1.在 web ...

  5. 在web.xml中配置监听器来控制ioc容器生命周期

    5.整合关键-在web.xml中配置监听器来控制ioc容器生命周期 原因: 1.配置的组件太多,需保障单实例 2.项目停止后,ioc容器也需要关掉,降低对内存资源的占用. 项目启动创建容器,项目停止销 ...

  6. 在哪个web.xml中配置welcome页面

    是在tomcat的web.xml中配置,而不是在你的%web-project-root%/WEB-INF/web.xml中! 示例 <welcome-file-list> <welc ...

  7. 在web.xml中配置SpringMVC

    代码如下 <servlet> <servlet-name>springMVC</servlet-name> <servlet-class>org.spr ...

  8. web.xml中配置启动时加载的servlet,load-on-starup

    web.xml中配置启动时加载的servlet,load-on-starup 使用servlet来初始化配置文件数据: 在servlet的配置当中,<load-on-startup>1&l ...

  9. 服务器启动时Webapp的web.xml中配置的加载顺序

    一 1.启动一个WEB项目的时候,WEB容器会去读取它的配置文件web.xml,读取<listener>和<context-param>两个结点. 2.紧急着,容创建一个Ser ...

随机推荐

  1. Chart For Asp.Net ----Overview

    一个图表有很多元素构成,所有元素都能通过图表API控制.图表API是面向对象的,可扩展的,高复用的.支持很多图表元素如:data series,data points in a series,char ...

  2. 分享第一次使用ProcessOn心得

    最近朋友推荐了我一款在线作图工具ProcessOn,感受使用了几天感觉确实很不错,在这里给大家分享一下! ProcessOn应该算的上是第一款完全免费在线作图工具,之前用过国外有类似的,不过都是付费的 ...

  3. C语言之强制类型转换与指针--#define DIR *((volatile unsigned int *) 0x0022)

    强制类型转换形式:(类型说明符) (表达式) 举例说明:1) int a; a = (int)1.9; 2)char *b; int *p; p = (int *) b; //将b的值强制转换为指向整 ...

  4. vector中的元素删除

    删除vector中的元素,最容易的方法就是使用vector的erase()函数. vector vec;for ( vector::iterator iter = vec.begin(); iter! ...

  5. config、make、make install

    .config/    .configure  (查看该目录下是否有这个文件,如果有makefile,可直接make)  配置 config是一个shell脚本,根据平台的特性生成Makefile文件 ...

  6. C#基础之类、组件和命名空间(二)

    一.实例化对象 Student s; 首先是在栈中开辟一块空间叫s,s里面的内容是空: s = new Student(); 在堆实例化Student对象,将对象的引用地址保存到栈s里.因此,s指向S ...

  7. Ubuntu 14.10 下设置时间同步

    在启动HBase机群的时候,发现了一个错误,因为机群时间不同步导致,所以要同步集群时间. Linux的时间分为System Clock(系统时间)和Real Time Clock (硬件时间,简称RT ...

  8. hdu 2041

    ps:这道题之前一直没思路,有大神提醒我用递推,但当时没搞清...今天做了那个小蜜蜂..才懂得用递推做这道题.. 代码: #include "stdio.h"long long d ...

  9. 2016-1-3点菜系统demo的实现,pickerView的学习

    // // ViewController.m // pickView // // Created by Mac on 16/1/3. // Copyright © 2016年 Mac. All rig ...

  10. Camel routes in Spring config file

    The normal spring bean definition configuration file, the xsi:schemaLocation only has two: beans and ...