Event and Listener in Servlet

Events are basically occurrence of something. Changing the condition of an item is known as an occasion.

We can perform some vital assignments at the event 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:

  • ServletRequestEvent
  • ServletContextEvent
  • ServletRequestAttributeEvent
  • ServletContextAttributeEvent
  • HttpSessionEvent
  • HttpSessionBindingEvent

Event interfaces

The event interfaces are as follows:

  • ServletRequestListener
  • ServletRequestAttributeListener
  • ServletContextListener
  • ServletContextAttributeListener
  • HttpSessionListener
  • HttpSessionAttributeListener
  • HttpSessionBindingListener
  • HttpSessionActivationListener

Topics in Servlet Events and Listeners