2

次のように 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"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">

    <!-- Config here. -->
<servlet>
    <servlet-name>SpringConfig</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>SpringConfig</servlet-name>
        <url-pattern>*.htm</url-pattern>
  </servlet-mapping>

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath: SpringConfig.xml</param-value>
  </context-param>

  <listener>    

    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>

  </listener>

  <error-page>
    <exception-type>404</exception-type>
    <location>/404error.html</location>
   </error-page>

</web-app>

これは、WebContent フォルダーにある単純な 404error.html ページです。

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
The Page You Are Looking For Is Not Available.
</body>
</html>

しかし、私はカスタムページを超えていません.何が欠けているのか教えていただけますか?

4

3 に答える 3