I have faced this question often in some mocks I had taken which asks about the order of loading that takes place for the different components.
Please tell me the order of class loading / instantiation which happen after a web application is deployed for all components / elements which can come in the web.xml (like servlets, listeners, filters, tags etc etc )
And one more question I have is does this order depend on the way the web.xml is written or is there a pre defined order which is fixed irregardless of the container?
I paste the specification's relevant part, which should answer both questions : SRV.9.12 Web Application Deployment 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. � Instantiate an instance of each event listener identified by a <listener> element in the deployment descriptor. � For instantiated listener instances that implement ServletContextListener, call the contextInitialized() method. � Instantiate an instance of each filter identified by a <filter> element in the deployment descriptor and call each filter instance�s init() method. � 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.