微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Spring jsf web.xml 错误页面不起作用

如何解决Spring jsf web.xml 错误页面不起作用

我正在使用 jsf 和 Primefaces 实现一个 Spring 网站。在 web.xml 中设置错误页面不起作用,我不知道为什么。 link 阅读本文后,我看不出我的代码有什么重要区别

我可以打开错误页面,但我没有转发给他们。当请求例如一个不存在的页面时。仍然存在白标错误页面

“此应用程序没有明确的 /error 映射,因此您将其视为后备。”

我的 web.xml。有没有更多信息,我可以发布?

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="4.0"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">

<error-page>
    <location>/errors/error.xhtml</location>
</error-page>
<error-page>
    <error-code>404</error-code>
    <location>/errors/error.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>

<welcome-file-list>
<welcome-file>ppwcStartContent.xhtml</welcome-file>
</welcome-file-list>

<context-param>
    <param-name>defaultHtmlEscape</param-name>
    <param-value>true</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

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

<session-config>
    <cookie-config>
        <http-only>true</http-only>
        <secure>true</secure>
    </cookie-config>
</session-config>

</web-app>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。