【JavaEE企业应用实战学习记录】MyGetAttributeListener
package sanglp.servlet; import javax.servlet.ServletContext;
import javax.servlet.ServletContextAttributeEvent;
import javax.servlet.ServletContextAttributeListener;
import javax.servlet.annotation.WebListener; /**
* Created by Administrator on 2016/10/5.
* 监听ServletContext范围内属性改变的Listener
*/
@WebListener
public class MyServletContextAttributeListener implements ServletContextAttributeListener { @Override
public void attributeAdded(ServletContextAttributeEvent servletContextAttributeEvent) {
ServletContext application=servletContextAttributeEvent.getServletContext();
//获取添加的属性名和属性值
String name=servletContextAttributeEvent.getName();
Object value=servletContextAttributeEvent.getValue();
System.out.println(application+"范围内添加了"+name+"值为"+value+"的属性"); } @Override
public void attributeRemoved(ServletContextAttributeEvent servletContextAttributeEvent) {
ServletContext application=servletContextAttributeEvent.getServletContext();
//获取添加的属性名和属性值
String name=servletContextAttributeEvent.getName();
Object value=servletContextAttributeEvent.getValue();
System.out.println(application+"范围内删除了"+name+"值为"+value+"的属性");
} @Override
public void attributeReplaced(ServletContextAttributeEvent servletContextAttributeEvent) {
ServletContext application=servletContextAttributeEvent.getServletContext();
//获取添加的属性名和属性值
String name=servletContextAttributeEvent.getName();
Object value=servletContextAttributeEvent.getValue();
System.out.println(application+"范围内替换了"+name+"值为"+value+"的属性"); }
}
【JavaEE企业应用实战学习记录】MyGetAttributeListener的更多相关文章
- 【JavaEE企业应用实战学习记录】optiontransferselect实现两个列表选择框
<%@ page contentType="text/html; charset=GBK" language="java"%> <%@tagl ...
- 【JavaEE企业应用实战学习记录】logFilter
package sanglp.servlet; import javax.servlet.*; import javax.servlet.annotation.WebFilter; import ja ...
- 【JavaEE企业应用实战学习记录】struts2实现登录并获取各个范围的数据
package sanglp; import com.opensymphony.xwork2.*; /** * Created by Administrator on 2016/10/6. */ pu ...
- 【JavaEE企业应用实战学习记录】struts配置文件详细解析
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-/ ...
- 【JavaEE企业应用实战学习记录】struts2登录
<%-- login.jsp Created by IntelliJ IDEA. User: Administrator Date: 2016/10/6 Time: 16:26 To chang ...
- 【JavaEE企业应用实战学习记录】struts国际化
<%-- Created by IntelliJ IDEA. User: Administrator Date: 2016/10/6 Time: 16:26 To change this tem ...
- 【JavaEE企业应用实战学习记录】servlet3.0上传文件
<%-- Created by IntelliJ IDEA. User: Administrator Date: 2016/10/6 Time: 14:20 To change this tem ...
- 【JavaEE企业应用实战学习记录】sessionListener
package sanglp.servlet; import javax.servlet.ServletContext; import javax.servlet.annotation.WebList ...
- 【JavaEE企业应用实战学习记录】requestListener
package sanglp.servlet; import javax.servlet.*; import javax.servlet.annotation.WebListener; import ...
随机推荐
- 单源最短路径算法——Dijkstra算法
#include <stdio.h> #include <stdlib.h> #include <string.h> /* run this program usi ...
- 准备使用 Office 365 中国版--邮箱迁移
微软产品一贯的作风是从来不缺文档和教程,Office 365也不例外.无论是最终用户还是企业IT管理员,都可参照Office 365使用指南顺利的开启Office 365之旅.不过比较奇怪的是,貌似很 ...
- line-height1.5和line-height:150%的区别
一.区别 区别体现在子元素继承时,如下: 父元素设置line-height:1.5会直接继承给子元素,子元素根据自己的font-size再去计算子元素自己的line-height. 父元素设置line ...
- .Net程序员Python之道---Python基础
最近对动态语言比较好奇.所以选择了学习Python这门语言.话不多说开始学习笔记. 一. Python 基础: 1. print对Python进行数据输出, #号后面是队友的输出结果, 通过encod ...
- [麦先生]Laravel框架实现发送短信验证
今天在做到用户注册和个人中心的安全管理时,我借助实现第三方短信平台在Laravel框架中进行手机验证的设置; 由于我们做的是一个为客户提供医疗咨询和保健品网站,所以对客户个人隐私的保护显得尤为重要, ...
- SVN报Previous operation has not finished; run 'cleanup' if it was interrupted错误的解决方法
做着项目突然SVN报Previous operation has not finished; run 'cleanup' if it was interrupted,进度又要继续,烦.百度一下发现很多 ...
- 用PS制作时尚美观的LOGO
今日,在网上看到一篇帖子,介绍了各种时尚美观的六边形LOGO,其中一个吸引了我的目光. 一时技痒,尝试着用PS把它临摹出来 1.新建文档,大小600*600 2.用多边形工具,边数选择6,按住Shif ...
- POJ1094[有向环 拓扑排序]
Sorting It All Out Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 33184 Accepted: 11 ...
- 扩展Unity的方法
写更少代码的需求 当我们重复写一些繁杂的代码,或C#的一些方法,我们就想能不能有更便捷的方法呢?当然在unity中,我们对它进行扩展. 对unity的类或C#的类进行扩展有以下两点要注意: 1.这个类 ...
- jq分页异步刷新 ,全局刷新问题
在做分页的时候,可能点击下一页全部刷新 这样写会导致动态刷新,页面全部刷新了 $("#pageList a").click(function () { var $s = $(thi ...