This section assumes that you've downloaded Sun's JSDK and installed and started Apache's Jakarta Tomcat. If you're using a different server you might need to modify these instructions somewhat, but the principles of servlet operation remain the same.
For the latest documentation on application development under Tomcat, read http://TOMCAT_HOME/src/doc/appdev/index.html. That manual shows you how to use the Java-centric build environment, Ant, to manage your servlet development.
If you're serious about developing software, take the time to download the complete Ant installation kit, which includes developer documentation, at http://jakarta.apache.org/tomcat/jakarta-tomcat/src/doc/appdev/index.html.
You'll also ...