my dog learned polymorphism
The moose likes Servlets and the fly likes WEB.Xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "WEB.Xml" Watch "WEB.Xml" New topic


Lucky Chawla

Joined: Aug 08, 2006
Posts: 22
Hi all
I have a small doubt, If I make a new "myapp" folder in tomcat,s eebapps directory ,And the all the necessary directories are in the myapp directory according to my container,s directory structure.
Now if built a simple html and placed it in myapp directory , My question is that to run this simple html page do i have to modify my web.xml or is ti necessary that web .sml should be there with following form

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"



Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
you don't need a WEB-INF directory nor a web.xml at all to run purely static content.

Having an eebapps directory isn't going to help though, unless you modify Tomcat's own configuration to look for content there.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Jeroen T Wenting:
you don't need a WEB-INF directory nor a web.xml at all to run purely static content.

Not true.
Tomcat won't consider your directory to be a webapp unless it sees a WEB-INF directory.

It is true that you can deploy a webapp without a web.xml file though.
It is also true that you will want one if you're writing anything more than a few trivial JSPs.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: WEB.Xml
jQuery in Action, 3rd edition