This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
Author

Where does the container look for the web.xml?

Sriram Sharma
Ranch Hand

Joined: Apr 12, 2006
Posts: 97
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?

Regards,
Sriram
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684


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.

http://nishanpatel.wordpress.com/2009/04/30/deploymentdescriptor/


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

Joined: Jan 10, 2002
Posts: 60804
    
  65

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] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Where does the container look for the web.xml?
 
Similar Threads
Regarding order of listener elements
web.xml and struts-config.xml
Passivate and its storage
Tomcat error??
Problem running servlets in tomcat 4.0.1