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 and issue URL :8080/examples.