servlet & filter & listener & interceptor

1。servlet

url传来之后,就对其进行处理,之后返回或转向到某一自己指定的页面。它主要用来在业务处理之前进行控制。
2。filter

url传来之后,检查之后,可保持原来的流程继续向下执行。

filter可用来进行字符编码的过滤,检测用户是否登陆,禁止页面缓存等

3。servlet 与 filter

都是针对url之类的,而listener是针对对象的操作的。如:

session的创建,Spring整合Struts,为Struts的action注入属性,web应用定时任务的实现,在线人数的统计等

4。interceptor

filter在struts.xml中配置,并且不是针对URL的,而是针对action,当页面提交action时,进行过滤操作。可由action自己指定用哪个interceptor 。

posted @ 2014-07-20 17:47  等风来。。  Views(179)  Comments(0Edit  收藏  举报
------------------------------------------------------------------------------------------------------------ --------------- 欢迎联系 x.guan.ling@gmail.com--------------- ------------------------------------------------------------------------------------------------------------