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. [Android L]SEAndroid增强Androd安全性背景概要及带来的影响

    1  SEAndroid背景   Android对于操作系统安全性方面的增强一直沿用Linux内核所提供的MAC强制访问控制套件SELinux,对权限进行了更为深度的管理,有效地控制着进程对资源的访问 ...

  2. 如何把自己的MaC本变成一台服务器

    Mac本Xcode10.9以后都默认安装阿帕奇服务器的,所以我们只需要找到他进行配置就可以了 下面看具体操作命令 vim编辑器命令 1.打开apache服务器,sudo apachectl start ...

  3. Microsoft.Owin.Hosting 实现启动webapp.dll

    Microsoft.Owin.Hosting 下面是 asp.net core 实现 using System;using System.Collections.Generic;using Syste ...

  4. 自定义可视化调试工具(Microsoft.VisualStudio.DebuggerVisualizers)vs.net开发工具

    背景: 话说:使用CYQ.Data时,会经常断点MDataTable的对象,为了查看表格的数据内容,在监视里会常ToDataTable(),然后借可DataTable的可视化方式查看表格. 近日:心中 ...

  5. Nexus Repository Manager 3.0 发布

    著名仓库管理工具Nexus,在2016年4月6日发布3.0版本(包括OSS版),相较2.*版本有很大的改变: 1. 从底层重构,从而提高性能,增强扩展能力,并改善用户体验 2. 升级界面,增加更多的浏 ...

  6. JAVA中的字符串小结

    String字符串是只读的,不可变的 查看String类的源码,可以发现String类是被final关键字修饰的: 另外还可以看下String类源码中的其它方法实现,随便举个可以修改String值的方 ...

  7. jQuery中find和filter的区别

    本文来自:http://blog.csdn.net/woshixuye/article/details/7255260 这是jQuery里常用的2个方法. 他们2者功能是完全不同的,而初学者往往会被误 ...

  8. Sql Server之旅——第十三站 对锁的初步认识

    终于这个系列快结束了,马上又要过年了,没什么心情写博客...作为一个开发人员,锁机制也是我们程序员必须掌握的东西,很久之前 在学习锁的时候,都是教科书上怎么说,然后我怎么背,缺少一个工具让我们眼见为实 ...

  9. Nginx中文手册

    Nginx 常见应用技术指南[Nginx Tips] 第二版 作者:NetSeek http://www.linuxtone.org (IT运维专家网|集群架构|性能调优) 目 录 一. Nginx ...

  10. JS代码判断字符串中有多少汉字

    $("form").submit(function () { var content = editor.getContentTxt(); var sum = 0; re = /[\ ...