自定义错误页面没有显示?

时间:2017-11-07 19:12:36

标签: html xml tomcat

我安装了Tomcat,每当用户点击404页或500页时,就会显示Tomcats错误页面。但是,然后我创建了一个自定义的404和500错误页面并将其放在我的web.xml文件中。但是,我无法看到显示的自定义错误页面。请检查我的代码,看看发生了什么。谢谢你的帮助。

这是我的代码:

        <?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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_3_0.xsd">

<context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Production</param-value>
    </context-param>
    <context-param>
        <param-name>report.url</param-name>
        <param-value>https://MY_URL_LINK.net/jasperserver-pro/rest_v5/reports/organizations/organization_2</param-value>
    </context-param>
    <context-param>
        <param-name>report.path.mode</param-name>
            <param-value>report.path</param-value>
    </context-param>
    <context-param>
        <param-name>report.path.test</param-name>
            <param-value>C:\\Program Files\\glassfish-4.1\\glassfish\\domains\\domain1\\applications\\PayApp-5.0-SNAPSHOT\\reports\\</param-value>
    </context-param>
    <context-param>
        <param-name>report.path</param-name>
        <param-value>/usr/share/glassfish3/glassfish/domains/domain1/applications/PayApp/reports/</param-value>
    </context-param>
<!-- THIS IS MY ERROR PAGES SHOWN BELOW --> 
 <error-page>
    <!-- Missing resource -->
 <error-code>404</error-code>
    <location>/Error404.xhtml</location>
</error-page>
    <error-page>
    <!-- Uncaught exception -->
 <error-code>500</error-code>
    <location>/Error500.xhtml</location>
</error-page>

    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
           25
        </session-timeout>
    </session-config>


    <filter>
        <filter-name>LoginFilter</filter-name>
        <filter-class>org.pay.filters.LoginFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>LoginFilter</filter-name>
        <url-pattern>/secure/*</url-pattern>
    </filter-mapping>
    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>


    <resource-ref>
        <res-ref-name>/oracleInstance</res-ref-name>
        <res-type>javax.sql.ConnectionPoolDataSource</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <resource-ref>
        <res-ref-name>jdbc/w2Instance</res-ref-name>
        <res-type>javax.sql.ConnectionPoolDataSource</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>


</web-app>

0 个答案:

没有答案