A servlet instantiates a JavaBean and stores it in the ServletContext object using the following
code:
com.mybean.Employee worker = new com.mybean.Employee();
servletContext.setAttribute(“employee”, worker);
The servlet then returns a response to the client, which subsequently makes another request to a
JSP in the same Web application as the original servlet. Which of the following allows the JSP to
retrieve the JavaBean that the servlet stored in the ServletContext?
A.
<jsp:useBean id=”employee” class=”com.mybean.Employee” scope=”servletcontext” />
B.
<jsp:useBean id=”employee” class=”com.mybean.Employee” scope=”request” />
C.
<jsp:useBean id=”worker” class=”com.mybean.Employee” scope=”application” />
D.
<jsp:useBean id=”worker” class=”com.mybean.Employee” scope=”session” />
E.
<jsp:useBean id=”worker” class=”com.mybean.Employee” />
F.
The original JavaBean cannot be retrieved.