I am new to servlet, and have a basic question regarding to it. I am struggle of making it work in Eclipse Luna. It always gave me an
Eventhough I have define my servlet in the /src/org/dung/TestServlet in the servlet file structure attachment. So I don't know why it could not find it and complain.
Also my basic TestServlet is as follow:
and the web.xml is defined as follow:
So if you spot something wrong or missing, please let me know.
Thank you so much!
Eventhough I have define my servlet in the /src/org/dung/TestServlet in the servlet file structure attachment.
The servlet container is looking for a compiled class file, it does not care about where your source is.
Another example of why I suggest beginners should NOT start with an IDE like Eclipse, it hides stuff from you and does things behind your back.
The servlets FAQ here at the ranch is a resource you need to get familiar with.
Thank you for your response.In term of IDE , I use Eclipse Luna. I followed the instruction from the tutorial and I have no idea why it is complaining that it could not find my file eventhough my file is defined under src/my package name/ java class. One thing that i am not sure of even though I compiled and clean my java file in eclipse Luna, it does not produce a class file in web-inf/lib. I don't know if it is hidden so i could not find it, or I will see it when I deploy the app to WAR file. In any case, I run my program from Eclipse Luna and I would like to see it running there before I deploy the WAR.
tom mi wrote:
One thing that i am not sure of even though I compiled and clean my java file in eclipse Luna, it does not produce a class file in web-inf/lib..
Please check the Properties of your project in eclipse. There is an option to override the directory where your compiled classes go. As I go with everyone, using IDEs is *NEVER* a good companion for beginners, as that masks out several things which definitely will NOT help the beginners. I suppose Eclipse Luna offers the default directory for storing the compiled classes as "build\classes". Instead it should be "WEB-INF\classes". After your reset this property, refresh the project and do build the project again. (You can better do a Clean compile).
Note: Beware of the case (lowercase, uppercase) of the directory structure as Java is a case-sensitive language. This directory should strictly be WEB-INF. It should NOT be any of Web-INF, web-inf, WEB-Inf etc.,