File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Filter in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Filter in servlet" Watch "Filter in servlet" New topic

Filter in servlet

Mukesh Prajapati

Joined: Feb 02, 2011
Posts: 10
is it possible to apply one Filter to more than two Servlet??? please reply soon...... please give me such example. how to do it?
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Yes, it is possible.

Why do you ask? Did you have some problem when you tried to do it?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
You can just map the filter to be executed on the urls that match your servlets.

So much trouble in the world -- Bob Marley
Stoian Azarov
Ranch Hand

Joined: Jun 01, 2011
Posts: 113
And an example:
I agree. Here's the link:
subject: Filter in servlet
It's not a secret anymore!