"Lu, Spencer" wrote:

> OK, I have just read the Servlet Specification 2.2, and it does not answer
> my first question, which was:
>
> When I go to the Servlet Examples page
> (http://localhost:8080/examples/servlets/index.html), there is a link that
> executes the Hello World servlet.  This link is
> http://localhost:8080/examples/servlet/HelloWorldExample.  How does Tomcat
> know that when it sees "/examples/servlet/" in the URL, it is supposed to
> look in the examples/WEB-INF/classes directory for the
> HelloWorldExample.class file?  I haven't been able to find anything in the
> server.xml or web.xml files that shows how this is configured.
>
> I see no servlet mappings in any of the configuration files that maps a
> servlet to "/examples/servlet/HelloWorldExample".
>
> Please tell me how this is set up.
>
> Thanks,
> Spencer
> [...]

Hi :-)   with jakarta-tomcat-3.2.1 and jakarta-tomcat-4.0-b(1/2/3), I find
the following in conf/server.xml:
  ...
 <!-- Tomcat Examples Context -->
 <Context path="/examples" docBase="examples" debug="0" reloadable="true">
  ...
the above defines a webapp/ServletContext->"/examples"

for accessing HelloWorldExample.class, we don't need to define Servlet mapping
if:
-HelloWorldExample.class is in WEB-INF/classes
- we only want to use the following to access it:
http://localhost:8080/examples/servlet/HelloWorldExample



Bo
Apr.13, 2001



Reply via email to