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 What is difference between server.xml and web.xml files? 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 "What is difference between server.xml and web.xml files?" Watch "What is difference between server.xml and web.xml files?" New topic
Author

What is difference between server.xml and web.xml files?

mini mehta
Ranch Hand

Joined: Oct 22, 2000
Posts: 120
what is the significance of following files in Tomcat
1. server.xml
2. web.xml
vivek sivakumar
Ranch Hand

Joined: Aug 09, 2001
Posts: 187
hi,
well to make things simple , server.xml is for the server and web.xml is specific for application.
To brief up more, there could be only one server.xml for any given server but there can be 100s(though not reality!) of web.xml. A server hosts many number of applications so each application could have a significant web.xml of its own!
server.xml >>> could have general authentication procedures which are common for all applications which run under it.
web.xml >>> could have significant proceures defined only for that particular appliaation to which it belongs.fo eg: when ever a application is launched then WELCOME.html should be the starting page and this could vary from one application to another which can be accomplished by web.xml!!!
hope this helps!!


SCJP, SCWD <br />A farmer learns more from a bad harvest than a good one.
mini mehta
Ranch Hand

Joined: Oct 22, 2000
Posts: 120
Can they both contain context information i,e <context> or its only server.xml.
BTW thanks for your help.
Mini
Originally posted by vivek sivakumar:
hi,
well to make things simple , server.xml is for the server and web.xml is specific for application.
To brief up more, there could be only one server.xml for any given server but there can be 100s(though not reality!) of web.xml. A server hosts many number of applications so each application could have a significant web.xml of its own!
server.xml >>> could have general authentication procedures which are common for all applications which run under it.
web.xml >>> could have significant proceures defined only for that particular appliaation to which it belongs.fo eg: when ever a application is launched then WELCOME.html should be the starting page and this could vary from one application to another which can be accomplished by web.xml!!!
hope this helps!!

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

Context is used by the tomcat server to map a URL and its virtual directories (among other serving-related functions) - it goes only in server.xml. The web.xml defines the structure and mapping of a specific web app independent of the local implementation of that app (URL &co). That keeps things portable so you can buy a web app off the shelf and not have to modify it internally to setup the high-level paths.


Customer surveys are for companies who didn't pay proper attention to begin with.
mini mehta
Ranch Hand

Joined: Oct 22, 2000
Posts: 120
Thanks Tim,
I appreciate the help. BTW do I need to declare every servlet I put in WEB-INF/classes in web.xml file. How about every JSP???

Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is difference between server.xml and web.xml files?
 
Similar Threads
how to configure oracle DataSource into Tomcat 6
CATALINA_HOME and CATALINA_BASE
web.xml Vs server.xml
Can i include inside web.xml and server.xml more xml files?
Probelm invoking a servlet with Tomcat 3.2.1