File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Which servelet to load??????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Which servelet to load???????" Watch "Which servelet to load???????" New topic

Which servelet to load???????

shivani anand
Ranch Hand

Joined: Dec 28, 2000
Posts: 155
Hi! All,

How Server knows which servelet is required to be loaded?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63548

If you "register" the servlet in your web.xml, you give it the complete classpath to the servlet (which must, of course, be in the classpath). If you don't need init params, your can just refer to it using the /servlet/ path in the URL.
Were you looking for more explicit details?

[Asking smart questions] [About Bear] [Books by Bear]
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Originally posted by Bear Bibeault:
If you "register" the servlet in your web.xml, you give it the complete classpath to the servlet (which must, of course, be in the classpath).

Does every app server have a web.xml file which will have entries for each servlet, or is this something that is specific to a particular app server?

SCJP Tipline, etc.
Karl Moss

Joined: Feb 08, 2002
Posts: 18
The notion of a web application was introduced with version 2.2 of the Servlet API. Web applications are a very important concept in that they allow a portable way to structure and bundle applications containing servlets, jsp, and other resources (images, html pages, etc.). The "glue" that binds this application together is an XML descriptor named web.xml (found in the WEB-INF directory off of the application root directory). Within web.xml you can specify things like servlet names, servlet mappings, welcome files, error pages, security constraints, etc. Prior to version 2.2 each servlet container had their own way of defining things like servlet mappings, so this really hindered the ability to port applications from one vendor to the next; web applications have solved this problem (for the most part).

Karl Moss,<br />Author of <a href="" target="_blank" rel="nofollow">Java Servlets Developer's Guide</a> <br /><a href="" target="_blank" rel="nofollow"></a> the Companion site.
I agree. Here's the link:
subject: Which servelet to load???????
It's not a secret anymore!