Somehow, the URL that comes in as part of the request from the client is mapped to a specific servlet on the server. This mapping of URLs to servlets might be handled in a number of different ways, and it’s one of the most fundamental issues you’ll face as a web app developer. The user request must map to a particular servlet, and it’s up to you to understand and (usually) configure that mapping. What do you think?
Flex Your Mind
How should the Container map servlets to URLs?
The user does something in the browser (clicks a link, hits the “Submit” button, enters a URL, etc.) and that something is supposed to send the request to a specific servlet (or other web app resource like a JSP) you built. How might that happen?
For each of the following approaches, think about the pros and cons.
Hardcode the mapping into your HTML page. In other words, the client is using the exact path and file (class) name of the servlet.
PROS:
CONS:
Use your Container vendor’s tool to do the mapping:
PROS:
CONS:
Use some sort of properties table to store the mappings:
PROS:
CONS: