The above deployment is better, coz you just don't need to mess up with the default web application of Tomcat in the future development as well... But your deployment is also alright... What problem are you facing now?
It looks like the problem you are having is that you're trying to view the file in the ROOT web app, but you are placing the file in a sub-directory. It's been a while since I used Tomcat, but I believe it treats this as a web-context ie a web app different to the one you've specified. Try placing the file in the tomcat\webapps\ROOT directory and verify that you can load it as localhost/hello.html To expand on the problem, servlet containers are designed to serve multiple separate 'applications' at the same time, and keeps them separate by giving them a named 'context'. Usually the behaviour is that the first part of the request is the context. Therefore http://localhost/app1/hello.html loads hello.html from the app1 context and http://localhost/app2/hello.html loads hello.html from the app2 context. Then there is a special context that has no name and is a convenient place to drop your application,s but sometimes nested directories get treated like contexts, and I believe this is the behaviour you are seeing. As I said, try dropping the file in the root directory and see if it works. Someone with more specific Tomcat knowledge may be able to provide a work-around. Dave
You have probably already done it. If you put my_dir in the webapps/ROOT directory, you should be able to see hello.html by going to http://127.0.0.1/my_dir/hello.html or if you haven't changed Tomcat's default port, the page would appear on http://127.0.0.1:8080/my_dir/hello.html -- also make sure Tomcat is on! As was mentioned above, usually you don't want to put things on the web this way. Usually you make a whole "web application" that you have Tomcat map to a URL, e.g. http://www.yourserver.com/foo or http://www.yourserver.com/, etc). There are of course lots of benefits to making your own web application instead of placing directories in webapps/ROOT, but that is something to worry about another day.
Jayson Falkner<br />email@example.com<br />Author of <a href="http://www.jspbook.com" target="_blank" rel="nofollow">Servlets and JavaServer Pages; the J2EE Web Tier</a>
Ko Ko Naing
Joined: Jun 08, 2002
Originally posted by Jayson Falkner: There are of course lots of benefits to making your own web application instead of placing directories in webapps/ROOT, but that is something to worry about another day.
That's what I have mentioned before... Deployment in Tomcat is not that difficult, as we might expect. But sometimes we will mess them up, if we do not carefully maintain the proper structure of Tomcat... Here is the link to the doing basic things with Tomcat by Mr.Kevin... U might want to have a look on it.... http://kevinj.develop.com/javahome/javatomcat.jsp John McDonald, hope your testing works well.... [ January 27, 2004: Message edited by: Ko Ko Naing ]
subject: how to expose defined directory under webapps