# web.xml Visual Editor: Web Application Listeners

Use the Web Application Listeners section of the `web.xml` Visual Editor to add, remove, and view the deployment information of your web application's listeners. Web application listeners give you more control over interactions with the `ServletContext` and `HttpSession` objects and let you efficiently manage the resources used by a web application. Web application listeners are classes that implement one or more of the servlet event listener interfaces. Application events notify web application listeners when servlet contexts and sessions are initialized and destroyed, as well as when attributes are added or removed from a context or session.

To deploy a web application listener, you must register it in the `web.xml` file. When you do this, you provide information needed by the server to deploy the web application listener. You tell the server which class should be loaded when a web application listener is called.

Before you can register a web application listener in the `web.xml` file, you must create it in the New File wizard or import it from your existing sources. You can use the Name and Location panel of the New File wizard to register a web application listener. If you have not done so, or if you want to modify a registered web application listener's deployment information, use the Web Application Listeners section of the `web.xml` Visual Editor.

In the Visual Editor, click General at the top of the editor to open the General section, then click the Web Application Listeners header to open the Web Application Listeners section.

Click Add to define the listener element with the following properties:

Element | Description
--- | ---
Listener Class | Specifies the listener's class, such as `MonitorMyCompanyName`.
Description | Specifies a description, such as `Monitor the servlet context for changes to the context parameter that defines the company name`.

Related Topics

Developing Applications with NetBeans IDE,

Copyright © 2016, Oracle and/or its affiliates. All rights reserved.