How do I bind a servlet to everything except /?
I have a server which I need to bind two servlets to.
The first is the "home" servlet, which I want to reside at /. This will display what is essentially a welcome page.
The second is a servlet which will serve content based on a url-shortener style link code. This needs to bind to any other request.
M开发者_Python百科y problem is that if I bind the second servlet to /* then this also includes /
Exact mapping has a bigger priority that path mapping. So you shouldn't have any problem if you map your home servlet to /
and the other one to /*
, because /
will take the precedence over /*
.
- Map specific servlet to "/index"
- Map generic servlet to "/*"
- Add
welcome-file
"index" in thewelcome-file-list
精彩评论