Javatpoint Logo

what is the difference between servlet and filter

By: mhnty_*** On: Wed Oct 08 10:39:59 IST 2014     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
Hi,

Can u tell me

What is the difference between Servlet and Filter ?
Up0Down

 


A filter is an object that can transform content and header of a request or response.

Filter provides functionality which can be “attached” to any web resource.



Servlet used for performing action which needs for particular request as user login, get response based on user role, interacts with database for getting data, business logic execution, and more.


Filter serve different purpose and servlet serve different purpose.





Image Created0Down

By: [email protected] On: Wed Oct 08 18:37:27 IST 2014 Question Reputation0 Answer Reputation392 Belt Series Points0 392User Image
Are You Satisfied :0Yes0No
 
Filters can be invoke before and after the invovation of a Servlet.
Its entry is defined in web.xml file.
Image Created0Down

By: [email protected] On: Sat Oct 11 15:54:31 IST 2014 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No