Which two are true?

Given:
String value = getServletContext().getInitParameter(“foo”);
in an HttpServlet and a web application deployment descriptor that contains:
<context-param>
<param-name>foo</param-name>
<param-value>frodo</param-value>
</context-param>
Which two are true? (Choose two.)

Given:
String value = getServletContext().getInitParameter(“foo”);
in an HttpServlet and a web application deployment descriptor that contains:
<context-param>
<param-name>foo</param-name>
<param-value>frodo</param-value>
</context-param>
Which two are true? (Choose two.)

A.
The foo initialization parameter CANNOT be set programmatically.

B.
Compilation fails because getInitParameter returns type Object.

C.
The foo initialization parameter is NOT a servlet initialization parameter.

D.
Compilation fails because ServletContext does NOT have a getInitParameter method.

E.
The foo parameter must be defined within the <servlet> element of the deployment descriptor.

F.
The foo initialization parameter can also be retrieved using
getServletConfig().getInitParameter(“foo”).

Explanation:



Leave a Reply 1

Your email address will not be published. Required fields are marked *