Multiple choice technology programming languages

Which of these is a correct fragment within the web-app element of deployment descriptor. Select the one correct answer. d

  1. <exception> <exception-type> mypackage.MyException</exception-type> <location> /error.jsp</location> </exception>

  2. <error-page> <exception-type> mypackage.MyException</exception-type> <location> /error.jsp</location> </error-page>

  3. <error-page> <exception> mypackage.MyException </exception-type> <location> /error.jsp </location> </error-page>

  4. <error-page> <exception-type> mypackage.MyException</exception-type> </error-page>

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The error-page element in web.xml contains either an exception-type subelement (for Java exceptions) OR an error-code subelement (for HTTP status codes), plus a required location subelement pointing to the error page. Option A uses the non-existent exception element. Option C incorrectly uses exception as element name. Option D is missing the required location element. Only option B has the correct structure.