package com.newegg.shopping.util.listener;

import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener; public class LoggedUserCounter implements HttpSessionListener, HttpSessionAttributeListener { private static int count = 0; public void sessionCreated(HttpSessionEvent event) {
System.out.println("------------session created!");
} public void sessionDestroyed(HttpSessionEvent event) {
} public void attributeAdded(HttpSessionBindingEvent event) {
if(event.getName().equals("admin") && ((String)event.getValue()).equals("admin")) {
count ++;
System.out.println("a user logged in ! now total :" + count);
}
} public void attributeRemoved(HttpSessionBindingEvent arg0) { } public void attributeReplaced(HttpSessionBindingEvent arg0) { } }

可折叠代码块package com.newegg.shopping.util.listener;

import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener; public class LoggedUserCounter implements HttpSessionListener, HttpSessionAttributeListener { private static int count = 0; public void sessionCreated(HttpSessionEvent event) {
System.out.println("------------session created!");
} public void sessionDestroyed(HttpSessionEvent event) {
} public void attributeAdded(HttpSessionBindingEvent event) {
if(event.getName().equals("admin") && ((String)event.getValue()).equals("admin")) {
count ++;
System.out.println("a user logged in ! now total :" + count);
}
} public void attributeRemoved(HttpSessionBindingEvent arg0) { } public void attributeReplaced(HttpSessionBindingEvent arg0) { } }

 

windows live Writer test的更多相关文章

  1. Windows Live Writer代码插件整理

    以下code插件命名按照 Windows Live Writer 中显示的插件名 1.Source code plug-in(cnblogs官方推荐) 界面: 效果: /** * Returns th ...

  2. Windows Live Writer 的昨日荣光

    今天这一篇文章,想写一写Windows Live Writer这款博客编辑器(最早的一个版本是2007年发布的).毫不夸张地说,这是为数不多的几款所见即所得的编辑器之一,当然,它的运行速度慢也是一个众 ...

  3. Windows Live Writer测试

    第一次使用Windows Live Writer,一堆问题,不知道是中国强大的局域网防火墙问题还是咋的,弄了半天. 1.C++的测试代码: int _tmain(int argc, _TCHAR* a ...

  4. Windows Live Writer发布测试

    通过Windows Live Writer发布文章测试!!!!

  5. 新语言代码高亮及Windows Live Writer插件开发

    最近在博客园做一些学习笔记.一个是看apple的swift官方书,另外一个是随学校课堂(SICP)学习scheme. 这两种语言都谈不上普及(或者说swift太新).博客园原来的windows liv ...

  6. Windows Live Writer体验

    [安装] 首先下载安装包安装软件,没啥好说的,baidupan有记录: 顺便下载两个工具,备用: a)SourceCodePlugin_version_1.1.zip 将WindowsLiveWrit ...

  7. Windows Live Writer 初次使用

    Windows  Live Writer 博客园文章的一款发布器,这篇文章就是通过其发布的,可以先在word中写好博客内容,直接粘贴到这里发布就OK,之前我都是先在Word中写好一份,然后在blogs ...

  8. 移动windows live writer文章的保存路径

    windows live writer强制安装在C盘,文章也是强制保存在我的文档中.那么我们想办法来改变保存的路径,防止重装系统的时候忘记保存C盘的东西. 网上找到的参考:http://www.dit ...

  9. MetaWeblog博客客户端工具之Windows Live Writer

    吐槽&注意的坑: 刚听说了有这么一个东西,据说Windows Live Writer开源之后就改名为Open Live Writer,我以为Open Live Writer就要比Windows ...

  10. Windows Live Writer技巧

    (此文章同时发表在本人微信公众号"dotNET每日精华文章",欢迎右边二维码来关注.) 题记:今天的内容虽然和开发技术无关,却应该和喜欢写东西的技术人员有关,比如我所有的文章都是用 ...

随机推荐

  1. Spring AOP 四大通知

    Spring AOP 四大通知 Spring 3.X 以前 1.前置通知,实现  MethodBeforeAdvice 接口,重写 public  void  before(Method  metho ...

  2. 【代码笔记】iOS-标题2个图标,点击的时候,页面跳转

    一,效果图. 二,工程图. 三,代码 RootViewController.h #import <UIKit/UIKit.h> @interface RootViewController ...

  3. xcode中info.plist文件相关问题

    <一>关于提示http://访问网络不安全的解决方法 提示错误: App Transport Security has blocked a cleartext HTTP (http://) ...

  4. RPM方式安装MySQL5.5.48 (Aliyun CentOS 7.0 & 卸载MySQL5.7)

    环境是阿里云的CentOS7.0,更新了yum源(更新yum源请参考https://help.aliyun.com/knowledge_detail/5974184.html)之后先是尝试安装了MyS ...

  5. Entity Framework在Asp.net MVC中的实现One Context Per Request(附源码)

    上篇中"Entity Framework中的Identity map和Unit of Work模式", 由于EF中的Identity map和Unit of Work模式,EF体现 ...

  6. Asp.net MVC中提交集合对象,实现Model绑定

    Asp.net MVC中的Model自动绑定功能,方便了我们对于request中的数据的处理, 从客户端的请求数据,自动地以Action方法参数的形式呈现.有时候我们的Action方法中想要接收数组类 ...

  7. 【故障处理】ORA-28040: No matching authentication protocol

    [故障处理]ORA-28040: No matching authentication protocol 1.1  BLOG文档结构图 1.2  前言部分 1.2.1  导读和注意事项 各位技术爱好者 ...

  8. Sql server之sql注入篇

    SQL Injection 关于sql注入的危害在这里就不多做介绍了,相信大家也知道其中的厉害关系.这里有一些sql注入的事件大家感兴趣可以看一下 防范sql注入的方法无非有以下几种: 1.使用类型安 ...

  9. 在win10中创建开机自动登陆的网络驱动器

    前提环境: win10系统电脑一台. centos系统电脑一台,在该系统中安装samba,并配置共享. 要解决的问题: 在win10做了网络映射,将centos共享的文件夹设置成本地硬盘.在映射时,也 ...

  10. [Top-Down Approach]My First C/S Program [Python]

    These days I was learning from Computer Networking --A Top-Down Approach by Kurose Ross. I modified ...