Redirect to an error page in JSF

喜欢而已 提交于 2019-12-04 14:39:54

That's not possible using the standard API facilities. If you redirect, then the information about the exception would get lost.

As to your concrete problem,

Due to this problem I have other problems with links and images paths in the error page.

that should never have formed a problem. This is just developer's own mistake. Apparently you're making them relative to the request URL, which is indeed asking for trouble. You should make them relative to the domain root instead.

E.g.

<a href="#{request.contextPath}/index.xhtml">Index</a>
<img src="#{request.contextPath}/resources/images/logo.png" />

But much better is to use real JSF components instead of plain vanilla HTML. They will automatically prepend the context path.

<h:link value="Index" outcome="/index.xhtml" />
<h:graphicImage name="images/logo.png" />
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!