spring jsf web.xml错误页不工作

x33g5p2x  于 2021-07-15  发布在  Java
关注(0)|答案(0)|浏览(262)

我正在用jsf和primefaces实现一个spring网站。在web.xml中设置错误页不起作用,我不知道为什么。链接阅读后,我看不出我的代码有什么重要的区别
我可以打开错误页,但我没有转发给他们。例如,当请求一个不存在的页面时。仍然存在白标签错误页。
此应用程序没有/error的显式Map,因此您将此视为回退
我的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>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题