Multiple choice technology web technology

What is the equivalent action code for the following piece of JSP code snippet? EmployeeBean harry = (EmployeeBean)request.getAttribute("harry"); if (harry == null) { harry = new EmployeeBean(); request.setAttribute("harry", harry); }

  1. <jsp:declareBean id = "harry" class = "EmployeeBean" scope = "request" />

  2. <jsp:createBean id = "harry" class = "EmployeeBean" />

  3. <jsp:useBean id = "harry" class = "EmployeeBean" scope = "request" />

  4. <jsp:useBean id = "harry" class = "EmployeeBean" />

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

The jsp:useBean tag with scope='request' exactly matches the Java code logic: it checks if 'harry' exists in request scope, and if null, creates a new EmployeeBean and stores it. Option A has wrong tag name, B has wrong tag name, and D omits scope specification which would default to page scope.