• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

deployment descriptor

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic