调试了两天都没有解决,郁闷
--------------------------------
代码:
package maoji;import java.util.Vector;
import javax.servlet.*;
import javax.servlet.http.*;public class SessionListener extends HttpServlet implements HttpSessionBindingListener{
private Vector v;
public SessionListener(){
this.v=new Vector();
}
public void valueBound(HttpSessionBindingEvent se){
this.v.add(se.getValue());
getServletContext().setAttribute("Online",v);
getServletContext().log("成功邦定");
}
public void valueUnbound(HttpSessionBindingEvent se){
this.v.remove(se.getValue());
getServletContext().setAttribute("Online",v);
getServletContext().log("成功解绑");
}
}
----------------------
web.xml内容:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"><web-app>
<listener>
<listener-class>maoji.SessionListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
----------------谢谢啦啦!!!!!!!!!!!
--------------------------------
代码:
package maoji;import java.util.Vector;
import javax.servlet.*;
import javax.servlet.http.*;public class SessionListener extends HttpServlet implements HttpSessionBindingListener{
private Vector v;
public SessionListener(){
this.v=new Vector();
}
public void valueBound(HttpSessionBindingEvent se){
this.v.add(se.getValue());
getServletContext().setAttribute("Online",v);
getServletContext().log("成功邦定");
}
public void valueUnbound(HttpSessionBindingEvent se){
this.v.remove(se.getValue());
getServletContext().setAttribute("Online",v);
getServletContext().log("成功解绑");
}
}
----------------------
web.xml内容:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"><web-app>
<listener>
<listener-class>maoji.SessionListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
----------------谢谢啦啦!!!!!!!!!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货