Primefaces 错误页面

Primefaces Error page

我想开发一个代码,将我重定向到 错误页面 而不会在页面上显示错误消息。示例:当我的代码中存在错误时,而不是显示这些东西

Message: viewId:/ui/misc/exceptionHandler.xhtml - A ViewExpiredException! 
StackTrace: javax.faces.application.ViewExpiredException: viewId:/ui/misc/exceptionHandler.xhtml - A ViewExpiredException! at
org.primefaces.showcase.view.misc.ExceptionHandlerView.throwViewExpiredException(ExceptionHandlerView.java:39
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

我宁愿看到一个错误页面说 PAGE NOT FOUND

请提供帮助。

您应该为此目的配置您的 web.xml 并将所有错误页面放在那里,例如:

<error-page>
    <error-code>404</error-code>
    <location>/location-of-your-errors-pages/error404.xhtml</location>
</error-page>

如果您使用的是 netbeans,那很简单,只需转至