Listener: Listener
Concept: One of the three major components of web
-
Event listener mechanism
- Event: One thing
- Event Source: Local events
- Listener: An object
- Register listeners: event, event source, listeners are bound together. When an event occurs on the event source, listeners execute code.
-
ServletContextListener: create and destroy objects listening Servletconte
- void contextDestroy (ServletContextEvent sce): calls before being destroyed
- void contextInitialized (ServletContextEvent sce): After the object is created will be called
-
step
-
Defining class implements interfaces ServletContextListener
-
Replication method
-
Configuration
-
web.xml
-
<listener></listener>
-
-
annotation
- @WebListener
-
-