I am fresh here and now be trapped by a simple trouble.Please help me. In my "SCWCDExamStudyKit" book's first example, the given web.xml file is as and the servlet is as With servlet compiled and located in the right place, the URL http://localhost:8080/chapter01/servlet/HelloWorldServlet still invalid. The tomcat I used is 5.0.28 while in the book version 4.0.1 is experimented. Is that the key point of my trouble? Could anyone give me some guide?
In the latest version of tomcat the default servlet invoker application is disabled. so the link like host/app/servlet/servletName will not work. You have to change this setting manually in the tomcat. Better way to use the <servlet-mapping> component to map the servlet to url-pattern.
I think in the web.xml you have to modify the complete siganture of <web-app> element. There are xml components in <web-app ......> which give which version of Sevlet you are using.
But trouble is remain. Being convinced of that <web-app> tag is lack of version info, I tried HelloWorldServlet in the servlets-examples package which run other servlet normally, and added a scope into web.xml under such package. And this time is still unfortunate. Is there any trouble with my HelloWorldServlet even if it was compiled well?
Does that mean you added a servlet-mapping, and it still doesn't work? Then you could post the relevant web.xml excerpt.
Or did you enable the invoker?
Joined: Jan 25, 2006
I have tried again. This time just put the HelloWorldServlet into a normal package and not modify the web.xml under such package, then OK. But the intention of the example to create a new package chapter01 and new web.xml still seems unreasonable.Cause with such package and web.xml, the HelloWorldServlet can run as expected.