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. 【代码笔记】iOS-禁止输入表情符号

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

  2. OC 入门

    OC 入门 关键词正确写法: Xcode 错误的写法: xcode iPhone 错误的写法:IPhone iOS 错误的写法:IOS OC 全称: Objective-C 错误的写法:Object- ...

  3. 分页查询的SQL语句

    select * from(select row_number() over (ORDER BY Id DESC) cyqrownum,t.* from [Table_TY_Member] t ) v ...

  4. WPF学习之路(十一)布局(续)

    布局实际上是一个Slot模型,其中每个父对象分配给子对象一个Slot,子对象可以自由占用Slot中的空间,通过Margin\VerticalAlignment\HorizontalAlignment控 ...

  5. PHP数据的序列化/反序列化

    最近在接触一个叫做medoo的mysql框架,这个框架有一个特点,在insert/update时,如果你给进的数据是array的话会自动转成序列化字符串,说实话这个东西以前还没怎么接触过,索性去搜索了 ...

  6. Serena Dimensions 介绍

    Serena Dimensions是配置管理工具,基于进程的软件更改和配置管理解决方案. 官方网址:http://www.serena.com/index.php/en/products/applic ...

  7. Linux多线程同步方式

    当多个线程共享相同的内存时,需要确保每个线程看到一致的数据视图,当多个线程同时去修改这片内存时,就可能出现偏差,得到与预期不符合的值.为啥需要同步,一件事情逻辑上一定是有序的,即使在并发环境下:而操作 ...

  8. Consul 启动命令

    服务端: nohup consul agent -server -bootstrap-expect 1 -config-dir /etc/consul.d/ -data-dir /var/opt/co ...

  9. ASP.NET MVC 拓展ActionResult实现Html To Pdf 导出

    之前实现了html直接转换为word文档的功能,那么是否也同样可以直接转换为pdf文档呢,网上搜了下html to pdf 的开源插件有很多 如:wkhtmltopdf,pdfsharp,itexts ...

  10. 烂泥:CentOS命令学习之tar打包与解压

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. tar命令一般是做打包和解压使用,有关tar命令的使用.我们可以通过帮助文档进行查看,如下: tar –help man tar tar有几个比较重要的 ...