u have to do some presteps to compile n run the servlet in tomcat.
first u have to set enviroment variables..
JAVA_HOME= refers to ur jdk ( like C:\jdk1.4 ) and
for tomcat 4.0 or higher
CATAIINA_HOME=refers to ur tomcat directory ( like C:\tomcat )
for tomcat lower then 4.0
TOMCAT_HOME=refers to ur tomcat directory ..
then u have to set path to servlet.jar which is under the tomcat directory
common/lib/servlet.jar
or u can copy n paste servlet.jar file under ur jdk folder jre\lib\ext
then u startup ur tomcat container then open the explorer n enter the address
http://localhost:8080/ into the location bar of the explorer..
i m sure if u do it fine ur servlet will compile n ready to run..