Java EE 7 Application Developer — Question 11

How do you specify a default error page in your web.xml file?

Answer options

Correct answer: B

Explanation

The correct answer is B because it properly uses the <error-page> tag along with <error-code>*</error-code> to specify that the page should be displayed for all error codes. Options A and C incorrectly use <on-error>, which is not a valid tag for defining error pages in web.xml. Option D lacks the <error-code> tag, making it insufficient for specifying a default error page.