Servlet mappings can be “fake”
The URL pattern you put into a servlet mapping can be completely made-up. Imaginary. Fake. Just a logical name you want to give clients. Clients who have no business knowing anything about the real physical structure of your web app.
With servlet mappings, you have two structures to organize: the real physical directory and file structure in which your web app resources live, and the virtual/logical structure.
The THREE types of <url-pattern> elements
EXACT match

DIRECTORY match

EXTENSION match

The virtual/logical structure exists simply because you SAY it exists!
The URL patterns in the DD don’t map to anything except other <servlet-name> elements in the DD.
The <servlet-name> elements are the key to servlet mapping—they match a request <url-pattern> to an actual servlet class.
Key point: clients request servlets by <url-pattern>, NOT by <servlet-name> or <servlet-class>!
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access