How can I pass init parameters to HttpSessionListener?
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开发者_如何学Go 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>
精彩评论