This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
hi all, iam trying to learn jsp using Tomcat. iam using the book head first servlets & jsp! i have been following the instructions in the book on creating packages/folders and placing them as follows:
html files: tomcat\webapps\Beer-v1\form.html servlet class files: tomcat\webapps\Beer-v1\WEB_INF\classes\com\example\web\BeerSelect.class when i tried to run the html file i got the error "404 the requested resource /Beer-v1/form.html" does not exist. i did some search on the internet and found that the html files need to be placed in the ROOT directry under webapps. i did that and the html file worked. next i tried to invoke the servlet but the error "requested resource /BeerSelect.do does not exist. i chkd the internet again and iam getting so many conflicting answers on where the classes files should be placed! has anyone placed similar problems? and where should i place all the files? thanks!
This could be just a typo on your part, but the directory is named "WEB-INF", not "WEB_INF". Inside WEB-INF you need a web.xml file where your servlets are mapped. Lastly, "BeerSelect.do" seems to indicate that you're using Struts, which is probably much more advanced than where you're at right now (unless BeerSelect.do is mapped to the BeerSelect.class which is a servlet; but that would need to be declared in web.xml).
Joined: Aug 27, 2004
hi Ulf Dittmer , yes the WEB-INF is a typo! srry! and yes BeerSelect.do is mapped to BeerSelect class file in the web.xml!
Joined: Mar 22, 2005
I think your class file is placed correctly. Why don't you post the <servlet> and <servlet-mapping> parts of your web.xml file; that could help point to the problem.