Multiple choice general knowledge science & technology

Which of the following allows to access Servlet's initialization parameters?

  1. Servlet

  2. ServletContext

  3. ServletConfig

  4. ServletInit

Reveal answer Fill a bubble to check yourself
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.