File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Where does the container look for the web.xml? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Where does the container look for the web.xml?" Watch "Where does the container look for the web.xml?" New topic

Where does the container look for the web.xml?

Sriram Sharma
Ranch Hand

Joined: Apr 12, 2006
Posts: 130
Where does the container look for web.xml?
I believe that the container looks for the web.xml when it starts up.
In my comp, there are lots of web.xml files.
Does the container read all the web.xml files?
Or does it read all the web.xml files inside all the WEB-INF folders present in the installed directory?

Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 689

Hi Sriram,

web.xml is most important part of any web application and is is only one per web application. So one application has only one web.xml file.
and that is why it is called deployment descriptor. when you are deploying your web application web.xml look inside WEB-INF folder and it is always be there.

so when you start your container the tomcat first look at web.xml inside WEB-INF/web.xml and according to what developer written inside web.xml container make initially configuration and set according to web application.

for more detail refer below url.

Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

Tomcat will look inside its webapps folder, as well as anywhere that you tell it to look via context declarations in server.xml, and in the host folder of the config folder.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Where does the container look for the web.xml?
It's not a secret anymore!