This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of web.xml file for deploying a servlet

 
shivang sarawagi
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me what is the use of a web.xml file, which is a deployment descriptor, while using a servlet ??

Is it mandatory to make a xml file for every servlet class ??
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, a single web.xml describes the servlets for the entire web app.

Within it, you must declare each servlet and its mapping. (Unless using Servlets 3, where you can substitute annotations.)
 
Miku Ranjan
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Yes Bear is right, if you are not using annotation base servlet then you have to mention your servlet along with the mapping in the web.xml file
If you will use eclipse like any ide for creating your servlet that part done automatically by the IDE.
 
Ankush Kaundal
Ranch Hand
Posts: 36
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Web.xml is the place where the web server container will check for the mapping of the servlet name to its class and accordingly handles the task to that servlet and so the flow goes on.
 
Karthikeyan Nadanasabapathy
Greenhorn
Posts: 11
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
web.xml is the deployment descriptor, can also be called the heart of any web application where all servlets are mapped.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic