public class HttpSessionBinding implements HttpSessionBindingListener { public void valueBound(javax.servlet.http.HttpSessionBindingEvent e) {
String aa="";
} public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent e) {
String aa="";}}
--------------web.xml----------------------
<listener>
<listener-class>femes.common.HttpSessionBinding</listener-class>
</listener>
----------------------------------------------
为什么监听不到事件?
String aa="";
} public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent e) {
String aa="";}}
--------------web.xml----------------------
<listener>
<listener-class>femes.common.HttpSessionBinding</listener-class>
</listener>
----------------------------------------------
为什么监听不到事件?
功能是为了实现.同一个用户ID不能同时登入.用什么接口好?
查看 session: attributeAdd/Remove/Replace 事件。
...这么多接口.都有什么区别啊
(数据库用户表是老系统的.不能加表明是否已登入的列,不然也很好处理)
Interface HttpSessionListener
All Superinterfaces:
java.util.EventListener --------------------------------------------------------------------------------public interface HttpSessionListener
extends java.util.EventListener
Implementations of this interface may are notified of changes to the list of active sessions in a web application. To recieve notification events, the implementation class must be configured in the deployment descriptor for the web application.
Since:
v 2.3
See Also:
HttpSessionEvent--------------------------------------------------------------------------------Method Summary
void sessionCreated(HttpSessionEvent se)
Notification that a session was created.
void sessionDestroyed(HttpSessionEvent se)
Notification that a session was invalidated.
就是这个东西了,两个方法分别是在会话创建和过期时被调用。