zoukankan      html  css  js  c++  java
  • 监听器

    一、监听器:主要是用来监听特定对象的创建或销毁、属性的变化;是一个实现特定接口的普通java类。

    二、servlet中哪些对象需要监听?

      request/session/servletContext

      分别对应,request监听器、session相关的监听器、servletContext监听器。

    三、监听器的接口

    (1)监听对象的创建/销毁

       Interface ServletRequestListener     监听request对象的创建或销毁

             Interface HttpSessionListener         监听session对象的创建或销毁

             Interface ServletContextListener     监听servletContext对象的创建或销毁

    (2)监听对象属性的变化

         Interface ServletRequestAttributeListener  监听request对象属性变化: 添加、移除、修改

             Interface HttpSessionAttributeListener      监听session对象属性变化: 添加、移除、修改

       Interface ServletContextAttributeListener   监听servletContext对象属性变化

    (3) session相关监听器

       Interface HttpSessionBindingListener             监听对象绑定到session上的事件    

            Interface HttpSessionActivationListener(了解)  监听session序列化及反序列化的事件

    四、监听器的开发步骤

      (1)编写普通java类,实现相关的接口

      (2)配置(web.xml)

    五、统计在线人数。实战

  • 相关阅读:
    JS函数节流
    JS中多种方式创建对象
    javascript的几种继承
    多进程基本概念
    APUE(1)——UNIX基本概念
    pthread
    使用TortoiseGit,设置ssh方式连接git仓库。
    mac系统下用ssh方式连接git仓库
    webstorm2017.02版本如何使用material theme
    谷歌浏览器的字体问题
  • 原文地址:https://www.cnblogs.com/h-g-f-s123/p/6344919.html
Copyright © 2011-2022 走看看