JSF 1.x generic exception handling

后端 未结 6 1046
耶瑟儿~
耶瑟儿~ 2021-02-02 14:25

If I have an exception in my business layer (e.g. a SQL exception in my JDBC connection bean), how can I propagate it with a custom message to a global error.jsp pa

6条回答
  •  一整个雨季
    2021-02-02 14:49

    You can put

    <%@ page errorPage="error.jsp" %>
    

    in jour jsp/jsf page. In error.jsp, jou would have:

    <%@ page isErrorPage="true" %>
    

    isErrorPage="true" will give your page another implicit object: exception (the same way you already have request and response on jsp page). You can then extract message from exception.

    Additional details

提交回复
热议问题