Reputation: 38228
After installing Tomcat you can browse http://localhost:8080/examples/servlets/servlet/HelloWorldExample
Why it isn't http://localhost:8080/servlets/servlet/HelloWorldExample
since examples is not refered to in Servlet-Mapping ?
<servlet-mapping>
<servlet-name>HelloWorldExample</servlet-name>
<url-pattern>/servlets/servlet/HelloWorldExample</url-pattern>
</servlet-mapping>
Upvotes: 0
Views: 260
Reputation: 1664
examples is a context path for examples web application deployed on Tomcat. Only for ROOT context you have the same url in servlet mapping and servlet url.
Upvotes: 1
Reputation: 1069
Maybe this answers:
Tomcat provides a number of excellent servlet examples in "\webapps\examples". The servlet source files are kept under "\webapps\examples\WEB-INF\classes", together with the compiled classes. To run the examples, start Tomcat server. Issue URL http://localhost:8080/examples.
https://www.ntu.edu.sg/home/ehchua/programming/java/JavaServletExamples.html
Upvotes: 1