0

web.xmlプログラムで定義されたエラー ページにリダイレクトするにはどうすればよいですか?

<error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/error.xhtml</location>
</error-page>

どうすれば/error.xhtml通過できFacesContextますか?

オーバーライドされたメソッドで例外が発生する場合があり、発生した例外をスローできず、手動で例外を処理する必要があります。たとえば、自分でエラー ページにリダイレクトする必要があります。

4

1 に答える 1

1

Omnifaces ライブラリを使用して取得できます。

ドキュメントから:

This configuration enum parses the /WEB-INF/web.xml and all /META-INF/web-fragment files found in the classpath and offers methods to obtain information from them which is not available by the standard Servlet API.

http://showcase.omnifaces.org/utils/WebXml

于 2013-05-17T14:55:38.553 に答える