File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes how use * in servlet mapping ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "how use * in servlet mapping ? " Watch "how use * in servlet mapping ? " New topic

how use * in servlet mapping ?

amir taghvayi
Ranch Hand

Joined: Sep 16, 2011
Posts: 54
my folders in my projects is :

i want a run a filter before as manager.jsp . the my web.xml setting is :

but the my filter not runed .

please help me !!!
Stefan Evans

Joined: Jul 06, 2005
Posts: 1518
You can not write such a filter mapping. The specification does not allow the use of a * in the middle of an expression.

My suggestion would be set it up to match as far as the * in the filter mapping, and then have the filter explicitly check for the remainder

And then in the filter...

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63540

My suggestions would be to ditch those URLs completely, and come up with more RESTful URLs that end with the variable part.

[Asking smart questions] [About Bear] [Books by Bear]
chandu gattu

Joined: Nov 02, 2011
Posts: 3
you can use as <url-pattern>/component/*</url-pattern> . It will work perfectly
amir taghvayi
Ranch Hand

Joined: Sep 16, 2011
Posts: 54
thanks all . i use your suggestions.
I agree. Here's the link:
subject: how use * in servlet mapping ?
It's not a secret anymore!