项目中页面未找到统一跳转到一个notfound页面
2015-11-22 12:45
316 查看
环境
访问项目根路径的文件
springMVC中的 mvc:default-servlet-handler的作用是在所有请求页面找不到时直接返回404错误码。
结合web.xml的配置和该handler可以很好的实现我们的需求
访问项目根路径的文件
环境
springMVC + TOMCAT访问项目根路径的文件
直接访问项目的根路径默认是取决于web.xml中的配置选项,在找不到的时候直接报错。现在我们需要在找不到的时候跳转到404notfound页面。springMVC中的 mvc:default-servlet-handler的作用是在所有请求页面找不到时直接返回404错误码。
结合web.xml的配置和该handler可以很好的实现我们的需求
xml <error-page> <error-code>404</error-code> <location>/page404.html</location> </error-page>
相关文章推荐
- 关于JSP配置文件web.xml加载顺序详解
- jsp web.xml文件的作用及基本配置
- JAVA web.xml 加载顺序
- j2ee之web.xml (Servlet 3.0)配置讲解
- 用过滤器处理乱码问题 javaweb
- struts2.2.3 web.xml文件配置
- Spring整合Dwr,Cannot locate BeanDefinitionParser for element [annotation-scan]
- Web.xml配置详解
- web.xml 中的listener、 filter、servlet 加载顺序及其详解
- web2.xml
- web3.xml
- web.xml配置详解
- spring3 MVC手工搭建Spring3项目demo
- context-param和init-param区别
- web.xml详细介绍
- [转]Struts配置文件详解,web.xml以及struts-cofig.xml,以及struts-cofig.xml中各个标签的作用。
- Java Web中web.xml文件的作用
- spring mvc 开发需要的jar包的用途详解
- 基于注解的 Spring MVC 简单入门-网摘
- [MVC] 深入浅出Spring MVC