nerdexam
Oracle

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…

Servlets

Question

ServletContextListeners are invoked in

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)
  • A
    9% (2)
  • B
    14% (3)
  • C
    73% (16)
  • D
    5% (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

#ServletContextListener#listener invocation order#web.xml declaration#context lifecycle

Community Discussion

No community discussion yet for this question.

Full 1Z0-899 Practice