(Since one is resource name & the second is directory), but I guess the container doesn't see it that way.
Well, there are two steps:
match to the web-applicationmatch to the servlet
this is how the spec describes the match to the web-application:
Upon receipt of a client request, the Web container determines the Web application to which to forward it. The Web application selected must have the the longest
context path that matches the start of the request URL. The matched part of the URL is the context path when mapping to servlets.
match to the servlet is described like this:
The path used for mapping to a servlet is the request URL from the request object minus the context path and the path parameters.
have a look at the picture:
There must be a match on the contextPath, so in the request URL (
http://localhost:8080/AppName/fooStuff ) there will be a match on
http://localhost:8080/AppName, where AppName is the (context-root of the) web-application on your server.
The remaining part ot the request URL (/foostuff) will be used to match against the url-patterns in your web.xml
Be careful: /foostuff doesn't have to be a valid directory in your web-app! It is a virtual mapping.
Does this clear your doubts?
Regards,
Frits