7days

快乐工作,快乐生活!

2010年6月7日

ServletConfig和ServletContext

摘要: 1.ServletContext在整个web应用程序生命周期内存在,用来保存全局对象,整个web应用都可以使用其获取context参数。当启动服务器后,servlet容器将读取web.xml中配置的context参数,进行初始化工作。ServletContext可以获取该参数。比如我们可以配置编码信息供web程序使用。web.xml[代码]ReadEncoding.java读取context参数中... 阅读全文

posted @ 2010-06-07 23:10 7days 阅读(797) 评论(0) 推荐(0) 编辑
HttpSessionBindingListener和HttpSessionAttributeListener区别

摘要: HttpSessionBindingListener和HttpSessionAttributeListener是两个经常让初学者弄混的监听器,其实它们有很大的区别。这2个监听器在文章中简称为BindingListener和AttributeListener. 1.BindingListener有2个方法,valueBound(HttpSessinBindingEvent)和valueUnbount... 阅读全文

posted @ 2010-06-07 15:39 7days 阅读(3015) 评论(0) 推荐(0) 编辑