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.
1)Catch the exception and use RequestDispatcher to forward the request to the error page.
2)Don't catch the exception and define the 'exception to error-page' mapping in web.xml
3)Catch the exception, wrap it into ServletException and define the 'business exception to error-page' mapping in web.xml
4)Catch the exception, wrap it into ServletException, and define the 'ServletException to error-page' mapping in web.xml
5)Don't do anything, the
servlet container will automatically send a default error page.
The given answers are 1 & 3.
I can't understand why answer 4 is wrong? can anyone explain a bit on this?