zoukankan      html  css  js  c++  java
  • 监听会话范围内事件

    1.HttpSessionBindingListener接口

    注意:HttpSessionBindingLister接口是唯一不需要在Web.xml中设定的Listener

    2.HttpSessionAttributeListener接口

    HttpSessionAttributeListener主要监听HttpSession中的属性的操作。这和ServletContextAttributeListener比较类似。HttpSessionAttributeListener接口主要提供了如下方法:

    1.当在Session中增加一个属性时,激发attributeAdded(HttpSessionBNindingEvent Event)方法;

    2.当在Session删除一个属性时,激发attributeRemoved(HttpSessionBindingEvent event)方法;

    3.当在Session属性被重新设置时,激发attributeReplace(HttpSessionBindingEvent sce)方法;

    HttpSessionListener监听HttpSession的操作。
    当创建一个Session时,激发sessionCreate(HttpSessionEvent se)方法;当前销毁一个Session时,激发sessionDestroyed(HttpSessionEvent sce)方法;

    HttpSessionActivationListener接口

    该接口提供了两个方法

    public void sessionDidActivate(HttpSesionEvent hse):会话被激活。

    public void sessionWillPassivate(HttpSessionEvent hse):会话被迁移。

    主要用于同一个Session转移至不同的JVM的情形。Jsp/Sevrlet标准不要求一个Web容器支持分布试应用,但是他一定要支持HttpSessionActivationListener接口,以使代码可以支持分布式环境。

  • 相关阅读:
    nodepad++的python环境变量设置
    notepad++怎么显示项目的目录树?
    转:Mysql explain
    转:Java NIO(3)
    转:Java NIO(2)
    转:Java NIO
    java 符号引用与直接引用
    Redis 基础命令
    适配器模式 & 装饰器模式
    classpath: spring 中的查找方式
  • 原文地址:https://www.cnblogs.com/hy66668888/p/5966198.html
Copyright © 2011-2022 走看看