Multiple choice technology web technology

What line of code below might be combined in the same JSP page with a validation guard (for example, <% bean.validationGuard(); %> ), in order to create an alternate flow of control for scenarios in which exceptions arise. The validationGaurd method might throw an exception, which should cause the flow of control to continue in another user-defined page (assume JSP 1.0).

  1. <jsp:error page="errorPage.jsp" guard="true" />

  2. <%@ page language="java" buffer="8k" %>

  3. <jsp:useBean id="bean" class="examples.Bean" scope="request" />

  4. <%@ page language="java" errorPage="errorPage.jsp" buffer="8k" %>

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

In JSP 1.0, the errorPage attribute of the page directive designates an error page to handle uncaught exceptions. When the validationGuard method throws an exception, control automatically transfers to errorPage.jsp. Options A and C are syntactically incorrect, and B only sets buffer size without exception handling.