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

    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    package cn.toher.listener;
    
    import cn.toher.bean.User;
    import cn.toher.dao.UserLogDao;
    import javax.servlet.http.HttpSession;
    import javax.servlet.http.HttpSessionEvent;
    import javax.servlet.http.HttpSessionListener;
    
    /**
     *
     * @author Administrator
     */
    public class SessionListener implements HttpSessionListener {
    
        public SessionListener() {
        }
    
        ;
    
        @Override
        public void sessionCreated(HttpSessionEvent se) {
        }
    
        @Override
        public void sessionDestroyed(HttpSessionEvent se) {
            HttpSession session = se.getSession();
            User user = (User) session.getAttribute("Suser");
    // 监听session中的user,如果它为空,则去动作
    if (user != null) { UserLogDao userLogDao = new UserLogDao(); userLogDao.addTimeout(user); } } }

     

  • 相关阅读:
    C语言-错误处理
    C语言-排序和查找
    PCB设计要点
    C语言-调试
    c++ 概述
    C语言-指针
    C语言-数组与指针 字符与字符串
    C语言-(void*)类型指针
    C语言-字符操作函数
    C语言-链表
  • 原文地址:https://www.cnblogs.com/itchenfirst/p/7287035.html
Copyright © 2011-2022 走看看