Question: what is the difference between filter and listener?
Answer: Listener is like listening (trigger) - whenever required, I will be performed. One important difference is often overlooked: while listeners get triggered for an actual physical request, filters work with servlet container dispatches. For one listener invocation there may be multiple filters/servlet invocations.