1. 概念
监听域对象的创建和销毁 监听域对象的属性操作。(增加、修改、删除) |
2. 分类
监听域对象的创建和销毁 ServletRequestListener HttpSessionListener ServletContextListener 监听域对象的属性操作 ServletRequestAttributeListener HttpSessionAttributeListener ServletContextAttributeListener |
3. 典型应用
统计在线人数 |
4. 统计在线人数实现步骤
1. 创建一个Listener监听器的类,监听session创建和销毁。实现HttpSessionListener
/** |
2. 编写jsp页面展示在线人数
<%@ page contentType="text/html;charset=UTF-8" language="java" %> |
3. 退出
@WebServlet(name = "ExitServlet", value = "/exitServlet") |