Using the templates in this category you can create: listeners.

Servlet API 2.3's second most significant change is the addition of application lifecycle events,
which let "listener" objects be notified when servlet contexts and sessions are initialized
and destroyed, as well as when attributes are added or removed from a context or session.