Explain Life cycle of Servlet Filter.
Answer Posted / sunita
filters life cycle:
The life cycle of a filter is managed by a container. Every
filter must implement the Filter interface. The life cycle
of a filter consists of implementing the following methods:
1. init(): This method is called only once after
instantiation to perform any initialization task.
2. doFilter(): This method is called after the init()
method. It takes three arguments, namely a ServletRequest, a
ServletResponse, and a FilterChain. It is called each time a
filter needs to perform any function. This method performs
the actual work of a filter, either modifying the request or
the response.
3. destroy(): This method is used to perform any cleanup
operation before the container removes a filter instance.
| Is This Answer Correct ? | 36 Yes | 2 No |
Post New Answer View All Answers
which type of objects reference will be given to client?
What event results from the clicking of a button?
What must a class do to implement an interface?
What is abstract schema?
What are JTA/JTS and how they used by client?
Name three subclasses of the component class?
Can I import same package/class twice? Will the jvm load the package twice at runtime?
Is “abc” a primitive value?
To what value is a variable of the string type automatically initialized?
Which component handles cluster communication in jboss?
Explain what is orm?
How are the elements of a cardlayout organized?
Explain how will the struts know which action class to call when you submit a form?
What is mdb and what is the special feature of that?
What is chat area? Explain.