problems with my first Servlet

Hello,

I'm using tomcat 5 and Java SDK 5.0

I have compiled a Java class called HelloServlet.class, which is in the package foo/bar.

Now I have copied the class to the tomcat directory \webapps\servlets-examples\WEB-INF\classes.

According to my book it should work now, but it doesn't.

under http://localhost:8080/servlets-examples/fo/bar/HelloServlet I get an Error Message HTTP-Status 404

What could I did wrong?

[458 byte] By [melliia] at [2007-10-3 1:34:00]
# 1

Have you made an entry for the your servlet in the web.xml of Examples?

you would have to include something like:

<servlet>

<servlet-name>HelloServlet</servlet-name>

<servlet-class>foo.bar.HelloServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>HelloServlet</servlet-name>

<url-pattern>/foo/bar/HelloServlet</url-pattern>

</servlet-mapping>

ragh_dra at 2007-7-14 18:32:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
thanks, now it works
melliia at 2007-7-14 18:32:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...