I am going to manually create some servlet files. But i checked out some tutorial that mentions Servlet(i.e MyServlet.java) must be created under the folder ../WEB-INF/classes/ .Of course, you need to create web.xml under the folder WEB-INF to modify the servlet mapping.
But if you are using ECLIPSE JUNO to create a servlet file via Dynamic Project, the servlet will be created in the Java source folder, NOT in the /WEB-INF/classes/. And it works fine. Thus is there any difference on those two way?
Servlet source code can be placed anywhere you want. In maven projects it’s
/src/main/java, as any other class. However after compiling servlet to bytecode it must be placed in.warfile under/WEB-INF/classes. It doesn’t matter which tool you use (or maybe you don’t use any tool at all), it must produce.warfile with predefined structure.That being said you are free to use any environment/IDE/tool and put your servlets source code anywhere you want, as long as you are able to produce standard
.warfile.