wood burning stoves 2.0*
The moose likes Servlets and the fly likes what is the use of servlet config object?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "what is the use of servlet config object??" Watch "what is the use of servlet config object??" New topic

what is the use of servlet config object??

senthil sen
Ranch Hand

Joined: Oct 10, 2002
Posts: 184
what is the use of the servlet object??and where can it be used often...
Nikki Aniban

Joined: Oct 10, 2002
Posts: 14
Hi! ServletConfig is an interface that has defined methods where you can get the initialization parameters that you specified for a particular servlet in your web.xml.
For example your web.xml look like this:
then in your servlet you can use this code to get the value of "diego":
Just check the API to see the other methods that are defined. But wait, here's the clincher, the ServletConfig is implemented by GenericServlet which is in turn, extended by HttpServlet. So, in the ideal world, you don't have to create an instance of ServletConfig just to get initialization parameters because you can directly access it from your servlet.
Bottomline is: ServletConfig is not used often.
Hope this answers your question.
Jagdeep Singh
Ranch Hand

Joined: Oct 14, 2002
Posts: 106
ServletConfig is a abstract interface and this object is used by a servlet CONTAINER to pass information to a servlet(s)during initialization.

Jagdeep Singh<br />SCJP;SCWCD;IBM Certified XML Solution Developer;SCBCD1.3
I agree. Here's the link: http://aspose.com/file-tools
subject: what is the use of servlet config object??