ErrorPage.jspがあります。
<h:messages styleClass="messageError" id="messages1"></h:messages>
バッキングBeanコンストラクターで例外が発生した場合、それをキャッチして次のようにします
public constructorxxx throws Exception{
// code
// code
// code
catch(Exception e){
try{
LOG.error(e);
String customMessage = "An Unknown Error At " + e.getStackTrace()[0].toString() + "at" + message;
getFacesContext().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR,
customMessage, null));
throw new Exception();
}catch (IOException exception){
LOG.error(exception);
}
}
} // end of constructor
私のWeb.xmlでは、次のタグを使用しました。
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/ErrorPage.jsp</location>
そうすると、次のエラーが発生します
1) Uncaught service() exception root cause Faces Servlet: javax.servlet.ServletException
2) An exception was thrown by one of the service methods of the servlet [/sc00/ErrorPage.jsp] in application [MembershipEligibilityScreensEAR]. Exception created : [java.lang.RuntimeException: FacesContext not found.
and in my page it displays as
SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.
Error Message: javax.servlet.ServletException
Error Code: 500
Target Servlet: Faces Servlet
Error Stack:
java.lang.Exception
// stack trace
Error Message: java.lang.RuntimeException: FacesContext not found
Error Code: 0
Target Servlet:
Error Stack:
java.lang.RuntimeException: FacesContext not found
多くの人から、ErrorPage.jspの場所を/sc00/ErrorPage.facesに変更するように求められましたが、web.xmlにリンク切れの警告が表示され、Webページを表示できないというエラーとプログラミングエラーが発生します。
jsf 1.2を使用していますが、「ErrorPage.jsp」にバッキングBeanがありません。
Error.jspが表示されない理由を誰かに教えてもらえますか?