Introduction
In this blog, I will explain to you the deployment descriptor used in a web application in java. Deployment Descriptor is a simple XML document that is used to map URL to the servlet. It tells the container how to run servlet and JSP. In a web application, Deployment
Descriptor file is saved with the name web.xml.
There are two XML elements that are used to map the URL to the servlet.
There are two XML elements that are used to map the URL to the servlet.
- <servlet>- it maps the internal name to servlet class name
- <servlet-mapping>- it maps the internal name to public name.
Now, first let us know about these internal,
public and class names of the servlet. A servlet can have three names.These are:-
- Class name - A servlet is given a
Class name by the developer who created it. The full path of a servlet file
is a combination of the servlet class name and its location on the server.
Example-: classes/record/SignUpServlet.class - Internal name - Servlet can also be given a deployment name. It is a secret internal name that can be same or different from the class name
- Public name - Servlet has a public name that is coded in HTML. Client knows that name and use it in URL to call the servlet.
A deployment descriptor file with both these
elements look like-:
- < servlet > < servlet - name > Internal1 < /servlet-name><servlet-class>src.Servlet1</servlet - class > < /servlet><servlet-mapping><servlet-name>Internal1</servlet - name > < URL - pattern > /public1</URL - pattern > < /servlet-mapping>
- <servlet-mapping> tag maps the internal name with the public name of the servlet.
- < servlet > tag maps the internal name with the class name of the servlet.
This is how the container loads the servlet that the client has requested. This is one of the use of Deployment Descriptor
.Some of the other uses of this file is to customize the web application like security code, error pages.
I hope this article was useful to you and thank you for reading it.

Gowtham RajamanickamPosted May 19, 2015, 12:48 AM
good one