为了账号安全,请及时绑定邮箱和手机立即绑定

监听HttpSesison产生和销毁

标签:
JQuery

import java.util.Date;import javax.servlet.http.HttpSession;import javax.servlet.http.HttpSessionEvent;import javax.servlet.http.HttpSessionListener;//监听器[用于监听HttpSesison产生和销毁]public class MyHttpSessionListener implements HttpSessionListener {    //产生        public void sessionCreated(HttpSessionEvent se) {            HttpSession session = se.getSession();            System.out.println(session.getId());            System.out.println("sessionCreated()" + new Date().toLocaleString());        }        //销毁        public void sessionDestroyed(HttpSessionEvent se) {            HttpSession session = se.getSession();            System.out.println(session.getId());            System.out.println("sessionDestroyed()");            System.out.println("sessionCreated()" + new Date().toLocaleString());        }}    <listener>        <listener-class>cn.xijie.listener.MyHttpSessionListener</listener-class>                </listener>     <session-config>        <session-timeout>1</session-timeout>    </session-config>

四月 20, 2018 1:38:46 下午 org.apache.catalina.startup.HostConfig reload
信息: Reloading context [/day04]
四月 20, 2018 1:38:46 下午 org.apache.catalina.core.StandardContext reload
信息: Reloading Context with name [/day04] has started
四月 20, 2018 1:38:47 下午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
四月 20, 2018 1:38:47 下午 org.apache.catalina.core.StandardContext reload
信息: Reloading Context with name [/day04] is completed
0CA6AE9F6B63E1BFADABA7B3091BA50A
sessionCreated()2018-4-20 13:39:03

点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消