Hello ranchers, I am trying to learn j2ee, servlets and Ejb. i am having a nightmare in running my first servlet program. Here is how my TestingServler looks like. here is the directory where i stored my .java file C:\jakarta-tomcat-5.0.14\webapps\myApp\WEB-INF\classes
and here is my web.xml file which i have placed in C:\jakarta-tomcat-5.0.14\webapps\myApp\WEB-INF
here is the directory where i stored my .java file
1. You mean the .class file, right ? You have compiled the servlet and put the .class file here, right ? Don't put java files in your classes directory. 2. You'd better put your servlet in a package, instead of putting it right under classes. 3. You need to define a <servlet-mapping> tag to map a url to your servlet. Try it, and if you still don't understand how to define it, come back
satou thanks for the reply. after hours of debugging i have left my laptop alone and will do it tomorrow morning. I was just following the steps in the book and they state to put java files in the classes directory. Lets see if i can put it in a package and then run the servlet file.
Ok Here i am back again. Looks like i had to bug myself for a long time. I did uncomment the lines as stated in the url(invoker servlet) and i have added the mapping also for the servlet, but still it is not compiling
type Status report
description The requested resource (/myApp/Testing) is not available.
ok glad i am able to run my first servlet program after hours and hours of debugging. OMG i hate authors of some books.
ANyways one more question and i guess i am all set to go to learn about j2ee . Excited and happy. I was wondering if i created an xml file web.xml just for that specific TestingServlet.java file where do i save it and how do i run it.
It's in chapter 1 of your book: Step 4: Create the Deployment Descriptor
Herman PS: if you use Tomcat 5, it's easier to use a book that also uses Tomcat 5. Your book uses Tomcat 4, and somethings just work differently... [ May 25, 2007: Message edited by: Herman Scheltinga ]