Monday, February 18, 2002 01:14 PM
If i may suggest, read the Servlet specification. You will see that provided that your context is /TestEditor, you should then call you servlet with http://localhost:8080/TestEditor/Hello, instead of http://localhost:8080/TestEditor/SERVLET/Hello. You should also declare the servlet inside the web.xml file.
it is not that complicated once you visualize how the URL is built:
http://localhost - tell which machine
8080 - to indicate where Tomcat is listening (first chance of misconfiguration)
TestEditor - this is to help tomcat (or any other servlet container) discriminate between all the .WAR files that are deployed on the machine (what the spec refers to as 'web application')
Hello - a web application can be built with multiple servlets, so the container needs to have a 'shorthand' way of refering to each one individually. The container will lookup this name into its internal list of servlets, which will tell it which java class to load and execute. The name does not have to be the same as the class name. For example:
http://localhost:8080/TestEditor/SERVLET/Hello could refer to package.package.package.MyClass.class
try to get in the habit of declaring all your servlets in the web.xml file (the application descriptor file, described in the servlet spec), instead of relying on the default loader. That will help you get a sense of how servlets are identified and called.
hope that helped