File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes servlet can't see html files? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "servlet can Watch "servlet can New topic

servlet can't see html files?

Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
I am using tomcat 5.0. I created an application using JBulider9.0 running tomcat 4.0. I tested the application and it is working fine. I took the .war file and I deployed it in tomcat/webapps folder. The container unziped the .war file and created the appropriat folders. Whe I run it, my servlet can't see my html files. I put the files in html folder, which is located at tomcat/webapps/myApp/html.
Inside my servlets, I refere to the html files as("/html/myPage.html")
any help is appreciated.
As all you can tell, I am new to this stuff.

SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

JBuilder might be automatically setting your web app base for you. Try changing the URL to /myApp/html/myPage.html and see what happens. If you use /html/mypage.html the servlet will look for tomcat/webapps/html/mypage.html.

GenRocket - Experts at Building Test Data
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
Thnks Greg:
your suggestion fixed the problem, however my servlets couldn't refere to another servles in the same package. for example:
RequestDispatcher dispatcher = req.getRequestDispatcher("/com_habashy_shoppingcart.calculateshoppingcartsevlet");
dispatcher.forward(req, res);
the previous line produce server error, becuase it can't find the resource required. I check web.xml file, and I made sure the all the serlets are listed there. but still doesn't want to work.
thank you again for your advise.
I agree. Here's the link:
subject: servlet can't see html files?
It's not a secret anymore!