Java_day29_servlet of the three major components of the listener listener

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.