web.xml 404 500 配置
web.xml
<error-page>
<error-code>404</error-code>
<location>/error404.html</location>
</error-page> <error-page>
<error-code>500</error-code>
<location>/error500.html</location>
</error-page>
controller.java
/**
* 404
*/
@RequestMapping(value = "/error404.html")
public String error404(Model model, HttpServletRequest request) {
return "/jsp/common/error404";
} /**
* 500
*/
@RequestMapping(value = "/error500.html")
public String error500(Model model, HttpServletRequest request) {
return "/jsp/common/error500";
}
spring mvc
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
tree /F
└─WEB-INF
│ web.xml
│
└─views
└─jsp
│
├─common
│ error404.jsp
│ error500.jsp
│
web.xml 404 500 配置的更多相关文章
- 使用Spring时web.xml中的配置
使用Spring时web.xml中的配置: <?xml version="1.0" encoding="UTF-8"?> <web-app x ...
- javaWeb项目中Web.xml的基本配置
这个地址写的非常好 ,欢迎大家访问 Å:http://www.cnblogs.com/hxsyl/p/3435412.html 一.理论准备 先说下我记得xml规则,必须有且只有一个根节点,大小写敏感 ...
- web.xml常用元素配置
tomcat服务器: tomcat是一个WEB服务器,所有的j2ee WEB程序可以在此处运行. tomcat服务器是一个符合j2ee标准的WEB服务器.则J2ee的EJB程序无法在此处运行. 如果要 ...
- 关于web.xml的welcome-file-list 配置与tomcat的关系:
关于web.xml的welcome-file-list 配置与tomcat的关系: 2018年04月18日 10:17:13 守望dfdfdf 阅读数:377 标签: welcome-file-lis ...
- Jsp在Web.xml中的配置
以下列出web.xml经常使用的标签元素及这些标签元素的功能: 1.指定欢迎页面.比如: <welcome-file-list> <welcome-file-list> < ...
- J2EE进阶(五)Spring在web.xml中的配置
J2EE进阶(五)Spring在web.xml中的配置 前言 在实际项目中spring的配置文件applicationcontext.xml是通过spring提供的加载机制自动加载到容器中.在web ...
- Spring中,applicationContext.xml 配置文件在web.xml中的配置详解
一.首先写一下代码结构. 二.再看web.xml中的配置情况. <?xml version="1.0" encoding="UTF-8"?> < ...
- Struts在Web.xml中的配置及Struts1和Struts2的区别
(1)配置Struts的ActionServlet <servlet>元素来声明ActionServlet <servlet-name>元素:用来定义Servle ...
- spring 和springmvc 在 web.xml中的配置
(1)问题:如何在Web项目中配置Spring的IoC容器? 答:如果需要在Web项目中使用Spring的IoC容器,可以在Web项目配置文件web.xml中做出如下配置: <!-- Sprin ...
随机推荐
- Haskell语言学习笔记(44)Lens(2)
自定义 Lens 和 Isos -- Some of the examples in this chapter require a few GHC extensions: -- TemplateHas ...
- javascript 函数对象
http://hi.baidu.com/gdancer/blog/item/a59e2c12479b4e54f919b814.html jQuery的一些写法就是基于这篇文章的原理的.. 函数 ...
- MongoDB 集合命令
集合命令 创建语法如下 name是要创建的集合的名称 options是一个文档,用于指定集合的配置,选项参数是可选的,所以只需要到指定的集合名称 可以不手动创建集合,向不存在的集合中第一次加入数据 ...
- Flexvolume
https://kubernetes.io/docs/concepts/storage/volumes/ https://github.com/kubernetes/community/blob/ma ...
- sass使用指南
[sass使用指南] http://www.ruanyifeng.com/blog/2012/06/sass.html
- Java.sql.SQLException: 无效的列类型: 1111
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: ...
- js string 字符串
mutil lines string 多行字符串, 由于多行字符串用\n写起来比较费事,所以最新的ES6标准新增了一种多行字符串的表示方法,用...表示,是单撇号, 不是单引号. 这是一个 多行 字符 ...
- hibernate编写流程
1.加载hibernatexml配置文件 2.创建sessionFactory 3.根据sessionFactory创建session 4.开启事务 5.持久化操作 6.提交事务 7.释放资源 其中第 ...
- Spring框架中的工厂(了解)
1. ApplicationContext接口 * 使用ApplicationContext工厂的接口,使用该接口可以获取到具体的Bean对象 * 该接口下有两个具体的实现类 * ClassPathX ...
- Linux sar
一.简介 sar(System Activity Reporter系统活动情况报告)是目前 Linux 上最为全面的系统性能分析工具之一,可以从多方面对系统的活动进行报告,包括:文件的读写情况.系统调 ...