This is question from Enthuware mock
test Which of the following is a sensible way of sending an error page to the client in case of a business exception that extends from java.lang.Exception?
Select 2 correct options
a Catch the exception and use RequestDispatcher to forward the request to the error page.
b Don't catch the exception and define the 'exception to error-page' mapping in web.xml
c Catch the exception, wrap it into ServletException and define the 'business exception to error-page' mapping in web.xml
d Catch the exception, wrap it into ServletException, and define the 'ServletException to error-page' mapping in web.xml
e Don't do anything, the
servlet container will automatically send a default error page.
The answer is a and c. I always get confused, Why cant 'd' be the answer?
Can we wrap the exception in to ServletException and then define Servlet exception instead of Business Exception?
What happen if we have to <exception-type>ServletException<exception-type>
<exception-type>BusinessException<exception-type> defined in web.xml.
Please clarify this.I read many times, but I could not get satisfactory answers