When configuring filters, I can pass some values to a filter as initial parameters in web.xml and obtain those values in Filter via FilterConfig. How can I configure some initial parameters in web.xml for HttpSessionListener? If this is not possible, what are alternatives?
In the code:
public class MyListener implements HttpSessionListener {
public void sessionCreated(HttpSessionEvent event) {
String value = event.getSession().getServletContext().getInitParameter(paramName);
}
}
And in web.xml:
<web-app ...>
...
<context-param>
<param-name>my_param</param-name>
<param-value>12345</param-value>
</context-param>
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