I'm confused about what listener classes do. For example, in this project there is a listener class referenced as so:
<listener>
<listener-class>com.sun.javaee.blueprints.petstore.model.CatalogFacade</listener-class>
</listener>
Is it as the name implies, just listening for actions to do?
Listener Classes get notified on selected events, such as starting up the application or creating a new Session.
Listener Classes :
These are simple Java classes which implement one of the two following interfaces :
javax.servlet.ServletContextListener
javax.servlet.http.HttpSessionListener
If you want your class to listen for application startup and shutdown events then implement
ServletContextListener
interface. If you want your class to listen for session creation and invalidation events then implementHttpSessionListener
interface.
Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With