1Z0-899 · Question #166
ServletContextListeners are invoked in
The correct answer is C. contextInitialized method are invoked in the order in which they are declared in the web.xml and the. public interface ServletContextListener extends java.util.EventListener Interface for receiving notification events about ServletContext lifecycle changes. In order to receive these notification events, the implementation class must be either declared in the deployment…
Question
Options
- ARandom order
- BcontextInitialized and contextDestroyed are invoked in the order in which they are declared in the web.xml
- CcontextInitialized method are invoked in the order in which they are declared in the web.xml and the
- DcontextInitialized and contextDestroyed are invoked in the reverse order of which they are declared in the
How the community answered
(22 responses)- A9% (2)
- B14% (3)
- C73% (16)
- D5% (1)
Explanation
public interface ServletContextListener extends java.util.EventListener Interface for receiving notification events about ServletContext lifecycle changes. In order to receive these notification events, the implementation class must be either declared in the deployment descriptor of the web application, annotated with WebListener, or registered via one of the addListener methods defined on ServletContext. Implementations of this interface are invoked at their contextInitialized(javax.servlet.ServletContextEvent) method in the order in which they have been declared, and at their contextDestroyed(javax.servlet.ServletContextEvent) method in reverse
Topics
Community Discussion
No community discussion yet for this question.