This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 18541

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
Similar Threads
Redirecting to login.jsp page?
Struts Filter
url rewrite
Tracking users and user security
Return to Login Page