• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Should we have web.xml for a web app?

 
vijay kumarg
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
vijay kumarg
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks John!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Kamesh Rao
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the specification a webapplication should always have a web.xml under WEB-INF folder.
 
Alex Sotin
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you need to have, it requires for Tomcat...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic