1.ServletContextAttributeListener
监听对ServletContext属性的操作,比如增加/删除/修改
2.ServletContextListener
监听ServletContext,当创建ServletContext时,激发contextInitialized (ServletContextEvent sce)方法;当销毁ServletContext时,激发contextDestroyed (ServletContextEvent sce)方法。
3.HttpSessionListener
监听HttpSession的操作。当创建一个Session时,激发session Created(SessionEvent se)方法;当销毁一个Session时,激发sessionDestroyed (HttpSessionEvent se)方法。
4.HttpSessionAttributeListener
监听HttpSession中的属性的操作。当在Session增加一个属性时,激发attributeAdded (HttpSessionBindingEvent se) 方法;当在Session删除一个属性时,激发attributeRemoved (HttpSessionBindingEvent se)方法;当在Session属性被重新设置时,激发attributeReplaced (HttpSessionBindingEvent se) 方法。
其中,HttpSessionListener中的sessionDestroyed并不会再浏览器关闭的时候立刻执行,只有在session超时的进入到sessionDestroyed方法中,所以想通过HttpSessionListener实现在浏览器关闭时的逻辑处理是不一定行不通的,个人觉得如果所做的逻辑处理允许一定的延迟(大于session超时时间),倒是可以考虑这种解决方案。
分享到:
相关推荐
Notification that an existing attribute has been removed from the servlet context. attributeRemoved(ServletRequestAttributeEvent) - Method in interface javax.servlet.ServletRequestAttributeListener ...
1.6.1 监听器(Listener)顺序 ...............................................................................................................14 1.6.2 注解处理 .............................................
本书共分4部分,从xml、servlet、jsp和应用的角度向读者展示了java web开发中各种技术的应用,循序渐进地引导读者快速掌握java web开发。. 本书内容全面,涵盖了从事java web开发所应掌握的所有知识。在知识的讲解...
本书共分4部分,从xml、servlet、jsp和应用的角度向读者展示了java web开发中各种技术的应用,循序渐进地引导读者快速掌握java web开发。. 本书内容全面,涵盖了从事java web开发所应掌握的所有知识。在知识的讲解...
本书共分4部分,从xml、servlet、jsp和应用的角度向读者展示了java web开发中各种技术的应用,循序渐进地引导读者快速掌握java web开发。. 本书内容全面,涵盖了从事java web开发所应掌握的所有知识。在知识的讲解...
本书共分4部分,从xml、servlet、jsp和应用的角度向读者展示了java web开发中各种技术的应用,循序渐进地引导读者快速掌握java web开发。. 本书内容全面,涵盖了从事java web开发所应掌握的所有知识。在知识的讲解...
Servlet3.1规范(最终版) JavaTM Servlet 规范 版本 3.1(最终版) Shing Wai Chan Rajiv Mordani [作者] 穆茂强 张开涛 [译者] 2012年6月翻译 2013年7月修订 目录 前言 ............................... 3 ...
5-4 与 Context 有关的隐含对象 5-5 与 Error 有关的隐含对象 第六章 Expression Language 6-1 EL 简介 6-2 EL 语法 6-3 EL 隐含对象 6-4 EL 算术运算符 6-5 EL 关系运算符 6-6 EL 逻辑运算符 6-7 EL 其他运算符 6-...
58:22,466 INFO ] org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:511) - Refreshing WebApplicationContext for namespace 'hessian-servlet': ...
代码如下:package cn.lang.any.listener; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class AmpList implements ... public void contextInitialized(ServletContext
5. context-param元素 6. filter元素 7. filter-mapping元素 8. listener元素 9. servlet元素 10. seervlet-mapping 元素 11. session-config元素 12. mime-mapping元素 13. welcome-file-list元素 ...
web项目设置在Servlet的context parameter中 事件Application Event 自定义事件,集成ApplicationEvent 定义事件监听器,实现ApplicationListener 使用容器发布事件 Spring高级话题 Spring Aware ...
Servlets和JSP核心技术 卷2 内容还是很详细的,看过卷1的人可以继续用这本书深造,呵呵 目录: Chapter 1. Using and Deploying Web Applications Section 1.1. Purpose of Web Applications Section 1.2. ...
Servlets和JSP核心技术 卷2 内容还是很详细的,看过卷1的人可以继续用这本书深造,呵呵 目录: Chapter 1. Using and Deploying Web Applications Section 1.1. Purpose of Web Applications Section 1.2. ...
LobHandler必须注入到Hibernate会话工厂sessionFactory中,因为sessionFactory负责产生与数据库交互的Session。LobHandler的配置如代码 5所示: 代码 5 Lob字段的处理句柄配置 1. 2. … 3. 4. class="org....
09. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 10. </listener> 11. 12. <servlet> 13. <servlet-name>spring</servlet-name> 14. <servlet-class>org.spring...
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> 在struts.xml中配置对象创建工具为spring <constant name="struts.objectFactory" value="spring" />
3. 在session 中完成对数据的增删改查和事务提交等. 4. 在用完之后关闭session 。 5. 在java 对象和 数据库之间有做mapping 的配置文件,也通常是xml 文件。 mybatis实战教程(mybatis in action)之一:开发环境搭建 ...
在准备跳转目标页面的servlet中,查询所有供应商信息. 传到页面上 2.在JSP页面上, 拿到传递来的供应商信息.动态展示在下拉列表中. (7)账单,供应商,用户新增修改时: 1.页面必须有JS客户端验证. 2.Servlet服务端...
4.7.2. Application context构造器中资源路径的通配符 4.7.3. FileSystemResource 说明 5. 校验,数据绑定,BeanWrapper,与属性编辑器 5.1. 简介 5.2. 使用Spring的Validator接口进行校验 5.3. 从错误代码到...