Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which servelet to load???????

 
shivani anand
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! All,

How Server knows which servelet is required to be loaded?
thanks,
SA
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
hth,
bear
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
Thanks,
Corey
 
Karl Moss
Author
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic