servlet 生命周期和过滤器生命周期之间的区别 [英] difference between servlet lifecycle and filter lifecycle
本文介绍了servlet 生命周期和过滤器生命周期之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
servlet 和过滤器生命周期之间有什么区别吗?.
is there any difference between servlet and filter lifecycle?.
推荐答案
不,一个 servlet 和一个过滤器:
No, both a servlet and a filter:
- 在上下文开始时实例化(一次)
init(..)
方法被调用- 他们处理每个请求 - 首先它通过所有过滤器,然后到达 servlet
- 当上下文被销毁时(即当您的容器停止时,或者您的应用程序从管理器控制台取消部署时),
destroy(..)
方法被调用
- are instantiated (once) when the context starts
- the
init(..)
method is called - they handle each request - first it passes through all filters and then reaches the servlet
- when the context is destroyed (i.e. when your container stops, or your application is undeployed from the manager console), the
destroy(..)
method is called
这篇关于servlet 生命周期和过滤器生命周期之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文