| Author |
Use of web.xml file for deploying a servlet
|
shivang sarawagi
Ranch Hand
Joined: Jun 19, 2008
Posts: 116
|
|
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
Joined: Jan 10, 2002
Posts: 56215
|
|
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.)
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Miku Ranjan
Ranch Hand
Joined: Oct 11, 2011
Posts: 98
|
|
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
Joined: May 12, 2011
Posts: 30
|
|
|
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
Joined: Dec 13, 2011
Posts: 11
|
|
|
web.xml is the deployment descriptor, can also be called the heart of any web application where all servlets are mapped.
|
 |
 |
|
|
subject: Use of web.xml file for deploying a servlet
|
|
|