【发布时间】:2014-04-25 08:12:28
【问题描述】:
我说的是纯 servlet 应用程序(假设没有使用框架)。 web.xml中不需要配置哪个Servlet Listener?为什么?谢谢。
【问题讨论】:
标签: servlets listener web.xml configure
我说的是纯 servlet 应用程序(假设没有使用框架)。 web.xml中不需要配置哪个Servlet Listener?为什么?谢谢。
【问题讨论】:
标签: servlets listener web.xml configure
HttpSessionBindingListener 没有在 DD 中注册.. 它只是自动发生.. HttpSession 对象应该自己解决这个问题。HttpSession 实现应该像下面这样工作:
public void SetAttribute( String name, Object value ) {
if( value instanceof HttpSessionBindingListener ) {
// Build HttpSessionBindingEvent
value.valueBound( event );
}
// Do the rest
}
【讨论】:
监听器HttpSessionActivationListener不需要在web.xml中配置。虽然我不知道不需要配置它的确切原因,但我认为它处理会话从一个 JVM 迁移到另一个 JVM 时的会话激活和被动事件。
您可以参考 javadoc 获取HttpSessionActivationListener
【讨论】: