Spring mvc<;错误页面>;不起作用
我一直在搜索并尝试各种不同的方法来映射我定制的404页面,但到目前为止没有任何效果。以下是my web.xml:Spring mvc<;错误页面>;不起作用,spring,spring-mvc,error-handling,http-status-code-404,custom-error-pages,Spring,Spring Mvc,Error Handling,Http Status Code 404,Custom Error Pages,我一直在搜索并尝试各种不同的方法来映射我定制的404页面,但到目前为止没有任何效果。以下是my web.xml: <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://java
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Spring3 MVC Application</display-name>
<servlet>
<servlet-name>spring-web</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>throwExceptionIfNoHandlerFound</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-web</servlet-name>
<url-pattern>/</url-pattern>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/views/404.jsp</location>
</error-page>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-web-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
</web-app>
Spring3MVC应用程序
弹簧网
org.springframework.web.servlet.DispatcherServlet
ThroweExceptionIfNoHandlerFound
真的
1.
弹簧网
/
*.htm
404
/WEB-INF/views/404.jsp
上下文配置位置
/WEB-INF/spring-WEB-servlet.xml
org.springframework.web.context.ContextLoaderListener
我已经尝试过要么只是放置错误页面标签,要么设置ifnoHandlerFoundException。似乎什么都没用。如果需要更多的代码或信息,请告诉我。谢谢您的帮助。验证页面的真实位置:
/WEB-INF/views/404.jsp
验证页面的真实位置:/WEB-INF/views/404.jsp