Yes, you have to edit \webapps\servlets-examples\WEB-INF\web.xml to include
your servlet.
All JSPs (at least, all JSPs ending in .jsp or .jspx) are mapped to the
JspServlet in tomcat\conf\web.xml--which is why you can add JSPs without
having to update Tomcat or webapp configuration; unless you uncomment the
invoker servlet definition in tomcat\conf\web.xml (which creates a security
hole--see the Tomcat documentation), you have to add the <servlet> and
<servlet-mapping> values to the app web.xml (and reload the app) before
Tomcat can find it.
Remember, if your servlet is part of a package, you have to use the fully
qualified class name in web.xml (ala com.myapp.mypackage.MyServlet) and put
the class file in the package-path directory
(WEB-INF/classes/com/myapp/mypackage/MyServlet.class).
At 09:18 AM 11/22/2005, you wrote:
I have compiled my first servlet and copied it into
apache-tomcat-5.5.12\webapps\servlets-examples\WEB-INF\classes but when I
navigate my browser to http://localhost:8080/servlets-examples/DemoServlet
or http://localhost:8080/servlets-examples/servlet/DemoServlet I got an HTTP
404 error message. Other servlets from Tomcat examples (same folder) works
just fine. What am I doing wrong? Do I have to edit web.xml in order to
inform Tomcat that I have deployed new servlet? While testing JSPs I didn't
had to do this for new JSP page. Btw, is there a good tutorial (or tool)
about configuring web.xml file?
--
David Rickard
Software Engineer
TechBooks/GTS
Your Single Source Solution!
Los Angeles CA * York, PA * Boston,MA * New Delhi, India
Visit us on the World Wide Web
<http://www.techbooks.com>http://www.techbooks.com
[EMAIL PROTECTED]
5650 Jillson St., Los Angeles, CA 90040
(323) 888-8889 x331
(323) 888-1849 (Fax)