1

나는 사용자 지정된 404 페이지를 매핑하는 모든 다른 방법을 시도했지만 지금까지 아무것도 작동하지 않습니다. 다음은 내 web.xml 파일입니다 :봄 mvc <error-page> 작동하지 않습니다

나도 방금 오류 페이지 태그를 넣어 또는 IfNoHandlerFound 예외를 설정하려고했습니다
<?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> 

. 아무것도 작동하는 것 같지 않습니다. 더 많은 코드 또는 정보가 필요한지 알려주십시오. 도와 주셔서 감사합니다.

답변

0

페이지의 실제 위치를 확인하십시오. <location>/WEB-INF/views/404.jsp</location>

관련 문제