Event and Listener in Servlet

Events are fundamentally occurance of something. Changing the condition of an article is known as an occasion.

We can perform some imperative errands at the occurance of these special cases, for example, including all out and current logged clients, making tables of the database at time of conveying the undertaking, making database association object and so on.

There are numerous Event classes and Listener interfaces in the javax.servlet and javax.servlet.http packages.

Event classes

The event classes are as follows:

  1. ServletRequestEvent
  2. ServletContextEvent
  3. ServletRequestAttributeEvent
  4. ServletContextAttributeEvent
  5. HttpSessionEvent
  6. HttpSessionBindingEvent

Event interfaces

The event interfaces are as follows:

  1. ServletRequestListener
  2. ServletRequestAttributeListener
  3. ServletContextListener
  4. ServletContextAttributeListener
  5. HttpSessionListener
  6. HttpSessionAttributeListener
  7. HttpSessionBindingListener
  8. HttpSessionActivationListener