This week's book giveaway is in the Performance forum. We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line! See this thread for details.
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?
Note: A business exception means a checked exception that an application throws upon encountering a violation of a business rule. For example, a withdrawAmount() method in Account class may throw NotEnoughFundsException. Here, NotEnoughFundsException is a business exception.
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.
Please rancher help me understand this question. I totaly confused with the given correct options. A, C