There's the 'quick and easy' way to deploy servlets, which is the approach taken in your book.
In short, when Tomcat receives '/servlet/' in any request, it invokes a class that goes and finds the appropriate servlet. This is work that it wouldn't have to do though, if you provided your own, more portable mappings.
As a very quick example for mappings,
Now if I define those entries inside my web.xml in the ServletAPI/WEB-INF directory, then
http://localhost:8080/ServletAPI/foo should invoke the servlet com.my.bar.foo
Doing it this way has the added advantage of 'hiding' your packaging and class name. (I can choose anything I want for "servlet-name" and "url-pattern")
For more info on how Tomcat does the magic with /servlet, open up <CATALINA_HOME>/conf/web.xml This file is heavily commented. Pay attention to the built in servlet definitions (the invoker starts around line 60) and the mappings (starting around line 234)
This file is very instructive both for how Tomcat provides the /servlet mapping service, and for how
you should build your own web.xml
[ April 28, 2002: Message edited by: Mike Curwen ]