Listener Listener
A. Listener Listener
1.Listener is one of the three major components provided by Javaweb, which is used to provide callbacks at specific times, and we can create different kinds of listener to implement code that we write ourselves in different situations.
2.Listener and servlet need to register, in Web. XML through the listener tag to register ( But there are two do not need to register )
3.Servletcontextlistener will be executed prior to any servlet/filter
A total of 8 listener are available in the 4.JavaWeb
1.ServletContext:
1.1,servletcontextlistener
1.2,servletcontextattributelistener
2.HttpSession
2.1,httpsessionlistener
2.2,httpsessionattributelistener
2.3,httpsessionbindinglistener-aware listener, no registration required
2.4,httpsessionactivationlistener -aware listener, no registration required
3.ServletRequest
3.1,servletrequestlistener
3.2ServletRequestAttributeListener
5. Statistics Online Sample code:
Java_day29_servlet of the three major components of the listener listener