This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The url-pattern tag is made to map a given url or string that match with a expression (in case of using wildcards), and about not let explicit pages like index.html or index.jsp they're mapped into the welcome-file at the deployment descriptor and you can map what you want to be the paths to look for when you receive a default path.
But i got what you're trying to do, i've made some tests and obviously you made some searchs about it and conclude that something else must be done to attend your needs. In servler/jsp mappings are three ways to map a resource: specific path (e.g.: /foo.bar), directory (e.g.: /omg/*) and extension (e.g.: *.foo), and the order i've described is the order of J2EE container parse them, but if you specify a pattern that doesn't match with any of this he will match with the most close to this, and in the case of "/" is directory mapping which gets everything with starts with "/", in others words, everything.
To do what you want to do you must use a filter and inside this filter you say what you want to capture (and redirect, in your case of redirecting to the home page) and those which you don't want to do anything, there is a lot of frameworks that do that and its called "Friendly URL's frameworks", they're written to make your URL's more friendly to your user and give the same semanthic by extracting the data in a fashion way.
Certainly others like this exists, but this one have a declarative way to map your urls, like an interface between your DD and your resources. Struts have something like that too in his main XML incorporated in his action mapping.
I hope this help you, if it don't or if you have any other doubt, feel free to ask me and i'll be pleased to help you!
Feel free to ask me anything!
www.BlackBeltFactory.com/ui#!/ref=jmotta, SCJP 6, OCWCD JEE5, OCE EJB JEE6
Joined: Sep 30, 2009
Hi Jayr Motta, thanks for the exhaustive answer that was really helpful in understanding more about how the J2EE container works.
I will have a look into the URL rewrite filter you posted and aim to complete this at some point soon.