Johny_M Johny_M - 24 days ago 8
Java Question

Where do we put the Servlets in the directory structure of Tomcat?

I copied a HelloServlet application i got from the web and put it in the ROOT folder.
I ran the server and it doesn't work.
What is wrong? I think its about the location of the Java classes.

Answer

this documentation should help you

http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html

/WEB-INF/classes/ - This directory contains any Java class files (and associated resources) required for your application, including both servlet and non-servlet classes, that are not combined into JAR files. If your classes are organized into Java packages, you must reflect this in the directory hierarchy under /WEB-INF/classes/. For example, a Java class named com.mycompany.mypackage.MyServlet would need to be stored in a file named /WEB-INF/classes/com/mycompany/mypackage/MyServlet.class.