Multiple choice technology programming languages

Which interface is implemented by the services in order to pass configuration information to a Servlet when it first starts

  1. Structs Config

  2. WebXML

  3. ServletConfig

  4. None of the above

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

ServletConfig is an interface implemented by the servlet container to pass configuration information (init parameters, servlet context) to a servlet during initialization. It's accessed via getServletConfig(). Struts Config is framework-specific, WebXML is deployment descriptor format.

AI explanation

In the Java Servlet API, when a servlet container instantiates and initializes a Servlet, it passes it a ServletConfig object (via the init(ServletConfig) method) that carries servlet-specific initialization parameters defined in web.xml, along with a reference to the ServletContext. This is the standard, documented mechanism for delivering startup configuration to an individual servlet. 'Struts Config' is a Struts-framework-specific configuration file, unrelated to the base Servlet API's init mechanism. 'WebXML' is the deployment descriptor file itself, not an interface implemented by services. ServletConfig is precisely the interface designed for this purpose.