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 ...
随机推荐
- egret -纹理集的制作
1. 理集的使用 :http://www.codeandweb.com/ 下载软件: TexturePackergithub: 相关工具:https://github.com/ping-chen/eg ...
- adb连接过程中常见问题解决方法
在测试过程中经常会遇到需要使用adb连接服务器的问题,但是有时候经常会遇到连不上的情况,总结两种解决方式 1)error: unknown host service 此问题是由于端口号已经被占用了,可 ...
- Linux Shell中有三种引号的用法
Linux Shell中有三种引号,分别为双引号(" ").单引号(' ')以及反引号(` `). 其中双引号对字符串中出现的$.''.`和\进行替换:单引号不进行替换,将字符串中 ...
- webpack 常用插件及作用
copy-webpack-plugin :复制文件到目标文件夹.在开发时使用热模替换,(没有生成dist 文件夹,都在内存中),如果想引用某一个js文件,直接写script标签是找不到的,因为服务器内 ...
- 安装64位的oracle数据库, 使用自带的sqldeveloper
个人感觉这个东西比plsql要好用, 虽然界面有点丑, 整个使用与plsql也没多大区别, 这里是他的位置C:\oracle_11g\product\11.2.0\dbhome_1\sqldevelo ...
- UVa 12100 Printer Queue(queue或者vector模拟队列)
The only printer in the computer science students' union is experiencing an extremely heavy workload ...
- python作业(第十一周)基于RabbitMQ rpc实现的主机管理
作业需求: 可以对指定机器异步的执行多个命令 例子: >>:run "df -h" --hosts 192.168.3.55 10.4.3.4 task id: 453 ...
- 【校招面试 之 C/C++】第17题 C 中的malloc相关
1.malloc (1)原型:extern void *malloc(unsigned int num_bytes); 头文件:#include <malloc.h> 或 #include ...
- python的多线程和守护线程
1.创建一个多线程 import threading import time ''' def threading_func(num): print("running on number:%s ...
- python之面向对象之继承
#写一个类SchoolMember class SchoolMember(object): member_num = 0 def __init__(self,name,age,sex): self.n ...