Which of the following allows to access Servlet's initialization parameters?
-
Servlet
-
ServletContext
-
ServletConfig
-
ServletInit
C
Correct answer
Explanation
ServletConfig provides access to a servlet's initialization parameters defined in web.xml using getInitParameter(). ServletContext is for application-wide parameters (accessed via context-param), Servlet is the base interface, and ServletInit is not a valid interface. Each servlet gets its own ServletConfig object during initialization.