aspose file tools*
The moose likes Servlets and the fly likes Should we have web.xml for a web app? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Should we have web.xml for a web app?" Watch "Should we have web.xml for a web app?" New topic
Author

Should we have web.xml for a web app?

vijay kumarg
Ranch Hand

Joined: Dec 14, 2006
Posts: 105
If a web application dont have a servlet then do we need web.xml?
In the obsence of web.xml how the container will start executing the application in responce to a client's request?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

Clients cant make requests to servlets that dont exist. A web application typically comprises of servlets and JSPs. Add some EJBs to that equation and you get an application that delegates the work of business logic to the EJBs. Now you have an enterprise application (which need not be confined to the concept of EJBs alone).

You can still have a web server that will service EJB clients even if you dont use servlets and JSPs. That means that you are not using the web container part of the web server where you would usually host your servlets and JSPs.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
vijay kumarg
Ranch Hand

Joined: Dec 14, 2006
Posts: 105
Thanks John!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
If a web application dont have a servlet then do we need web.xml?


That depends on where your web application files are located. In Tomcat the web-apps/ROOT directory uses the default web.xml found in the conf directory to serve files by the default servlet.

In Tomcat if you want to use another directory as a base you will need a minimum web.xml because Tomcat only considers directories that contain a WEB-INF\web.xml to be applications.

Bill


Java Resources at www.wbrogden.com
Kamesh Rao
Ranch Hand

Joined: Dec 24, 2006
Posts: 35
According to the specification a webapplication should always have a web.xml under WEB-INF folder.
Alex Sotin
Greenhorn

Joined: Dec 19, 2006
Posts: 21
Yes you need to have, it requires for Tomcat...


<a href="http://www.planet-java.org" target="_blank" rel="nofollow">Java Planet</a> <br />-- <a href="http://www.java-index.org" target="_blank" rel="nofollow">Java Index</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Should we have web.xml for a web app?
 
Similar Threads
HFSJ-->page 407 Errata...
web.xml --- failover for DBs (Urgent)
Spring Transaction using AOP in EJB Project
Configuring Servlets in web.xml
WEB.XML file not found when using Ecllipse IDE