I google for some good tutorials and then I see example of using the Servlet and ServletListener classes. I wonder why they place the same jobs in init(ServletConfig cfg) of the Servlet and in contextInitialized(ServletContextEvent event) of the ServletListener.
Wouldn't it be double jobs? Who's going to run first?
The context listener will execute when the server places the context (web app) into service. It will execute prior to the initialization of any servlet.
Initialization intended for the web application should be handled by the listener. Initialization specific to a servlet should be handled in the init() method of that servlet. [ November 11, 2007: Message edited by: Bear Bibeault ]