Web.xml 错误或异常页面配置

     <error-page> 

        <error-code>404</error-code> 

        <location>/error/hello?i=1</location> 

    </error-page> 

    <error-page> 

        <error-code>500</error-code> 

        <location>/WEB-INF/error/500.jsp</location> 

    </error-page> 

    <error-page> 

        <exception-type>java.lang.Exception</exception-type> 

        <location>/WEB-INF/exception/error.jsp</location> 

    </error-page>

时间: 2024-08-02 08:24:07

Web.xml 错误或异常页面配置的相关文章

SpringBoot系列教程web篇之404、500异常页面配置

接着前面几篇web处理请求的博文,本文将说明,当出现异常的场景下,如404请求url不存在,,403无权,500服务器异常时,我们可以如何处理 原文友链: SpringBoot系列教程web篇之404.500异常页面配置 I. 环境搭建 首先得搭建一个web应用才有可能继续后续的测试,借助SpringBoot搭建一个web应用属于比较简单的活; 创建一个maven项目,pom文件如下 <parent> <groupId>org.springframework.boot</gr

web.xml的作用及基本配置

web工程中的web.xml文件有什么作用呢?它是每个web.xml工程都必须的吗? 一个web中完全可以没有web.xml文件,也就是说,web.xml文件并不是web工程必须的.那什么时候需要,什么时候可以不需要呢?要想回答上面的问题,得先了解web.xml文件使用来干什么的.web.xml文件是用来配置:欢迎页.servlet.filter等的.当你的web工程没用到这些时,你可以不用web.xml文件来配置你的web工程. 那么web.xml能做的所有事情都有那些? 其实,web.xml

JSF web.xml的各类参数属性配置

出处:http://www.cnblogs.com/zxpgo/articles/2570175.html 感谢作者的分享!! —————————————————————————————————————————————————— JSF提供的核心控制器是javax.faces.webapp.FacesServlet. web.xml中的welcome-file-list标签作用:当用户在浏览器中输入的URL不包含某个servlet名或JSP页面时,welcome-file-list元素可指定显示

【spring in action 学习--springMVC搭建】在不使用web.xml的情况下,配置Srping MVC工程

一.Spring MVC 简介 DispatcherServlet是Spring MVC的核心,他负责将请求路由到其他的组件中. 在servlet3.0 之前,传统的搭建Spring MVC工程时,像DispatcherServlet这样Servlet都会配置在web.xml文件中. 在servlet3.0 中对功能进行了增强, 所以不需要将DispatcherServlet配置在web.xml中. 二. 相关代码 1.webconfig---> 这个文件中主要是用来几个功能:a.启用 Spri

servlet的web.xml文件的几种配置方式

<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http

web.xml文件的作用及基本配置

Java的web工程中的web.xml文件有什么作用呢?它是每个web工程都必须的吗? 一个web中完全可以没有web.xml文件,也就是说,web.xml文件并不是web工程必须的. 那什么时候需要,什么时候可以不需要呢? 要想回答上面的问题,得先了解web.xml文件是用来干什么的.web.xml文件是用来配置:欢迎页.servlet.filter等的.当你的web工程没用到这些时,你可以不用web.xml文件来配置你的web工程. 那么web.xml能做的所有事情都有那些? 其实,web.

Jsp在Web.xml中的配置

下面列出web.xml常用的标签元素及这些标签元素的功能: 1.指定欢迎页面,例如: <welcome-file-list> <welcome-file-list> <welcome-file>index.jsp</welcome-file> <welcome-file>index1.jsp</welcome-file> </welcome-file-list> 上面的例子指定了2个欢迎页面,显示时按顺序从第一个找起,如果

tomcat web.xml 配置

1<web-app> 2<error-page> 3<error-code>404</error-code> 4<location>/NotFound.jsp</location> 5</error-page> 6<!-- --> 7</web-app> 这样就可以了 下面的link可以看到更进一步的说明 http://fanqiang.chinaunix.net/app/web/2006-04-2

servlet3.0以后无需在web.xml中配置servlet

//下面这句话代替了web.xml中对servlet的配置 @WebServlet("/Upload") public class Upload extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletExceptio