aspose file tools*
The moose likes Servlets and the fly likes deployment descriptor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "deployment descriptor" Watch "deployment descriptor" New topic
Author

deployment descriptor

ravindranath
Greenhorn

Joined: Nov 07, 2004
Posts: 13
Hi all...i started reading servlets and i have a question about deployment descriptor.i didnt undertand the concept of deployment descriptor.Do i need to write deployment descriptor(.xml) for every servlet program i write.somebody help me with this
thanks
tagore
Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
The deployment descriptor (web.xml file in Tomcat) initializes and maps your Servlets to specific URL patterns. When a request comes in that matches one of the URL patterns you define in the deployment descriptor, the server calls the appropriate Servlet mapped to that URL pattern.

You might see something like this in an HTML form:


The URL pattern is servlet/ProcessFormServlet. Now, in your deployment descriptor, you should define a servlet called ProcessFormServlet. You should map this servlet to the URL pattern servlet/ProcessFormServlet. Realize, there is no actual servlet directory -- this is simply a URL pattern that you define that maps to your servlet.

The deployment descriptor allows you to define and intialize servlets, configure your web app, and a whole lot of other cool stuff too. You might look at investing in a good book. Specifically, if you're using Tomcat, I'd suggest Mastering Tomcat Development by Harrison.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12836
    
    5
You should also go to this Sun web site and download the servlet API. It is very complete - everybody doing servlets should have a copy.
Bill
Senthil B Kumar
Ranch Hand

Joined: Feb 09, 2004
Posts: 140
You had misunderstood.

The deployment descriptors are not for each servlets. Each web application (it may contain, how many ever servlets it needs), will be accombanied with a depolyment descriptor.


Work like you don't need the money. Love like you've never been hated. Dance like nobody's watching. Sing like nobody's listening. Live like it's Heaven on Earth.
Currently I Reside Here WEBlog
Fisher Daniel
Ranch Hand

Joined: Sep 14, 2001
Posts: 582
Hi,
web.xml is a configuration file which is used to configure our web application.
It define all servlets and filters inside a web application, welcome pages, security, etc.
Because of that, every web application has to have a web.xml file and it is stored inside folder WEB-INF.

Correct me if I am wrong...
Hope this help you..

daniel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: deployment descriptor