A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
Beginner question about where to put servlet for application run under Tomcat
Joined: Oct 13, 2007
Apr 06, 2009 09:36:21
I'm trying to create my first
Let say my first application, I tried to put the .class file inside /apps/servlet then I tested the URL but I got HTTP 404 error.
I also tried putting it under /apps/WEB-INF/classes but it also gives me the same error.
Can someone please advise?
Thanks in advance for all the help.
Joined: Sep 29, 2008
Apr 06, 2009 09:45:09
Classes should go under /WEB-INF/classes, following package notation. So if the class is bar.baz.MyFirstServlet.class its directory location would be /WEB-INF/classes/bar/baz/MyFirstServlet.class.
The servlet also needs to be mapped, however; mere existence in the classpath isn't enough: for example, see
or search the web for other examples.
Author and ninkuma
Joined: Jan 10, 2002
Apr 06, 2009 10:03:43
Have you read the Servlet Specification? If not, do so before writing another single line of code.
Asking smart questions
Books by Bear
I agree. Here's the link:
subject: Beginner question about where to put servlet for application run under Tomcat
trouble with an example servlet
startup.bat stops itself
help, where to put servelet, html, jsp file
How to upgrade servlets to Tomcat 5.0?
URGENT: How to include GPS external libraries in the project?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014