Select the correct sequence of actions that a servlet container performs before servicing any request.
1. Instantiate listeners defined in the deployment descriptor.
2. Initialize filters defined in the deployment descriptor.
3. Initialize servlets that are set to load on startup.
4. Call the contextInitialized method on the listeners implementing ServletContextListener interface.
Filters are always launched before servlets cause they intercept servlets' requests and act as preprocessors.
So the correct sequence is 1,4,2,3.
When a web application is deployed into a container, the following steps must be performed, in this order, before the web application begins processing client requests.
1. Instantiate an instance of each event listener identified by a <listener> element in the deployment descriptor.
2. For instantiated listener instances that implement ServletContextListener, call the contextInitialized() method.
3. Instantiate an instance of each filter identified by a <filter> element in the deployment descriptor and call each filter instance�s init() method.
4. Instantiate an instance of each servlet identified by a <servlet> element that includes a <load-on-startup> element in the order defined by the load-onstartup element values, and call each servlet instance�s init() method.