This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design 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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: what is the use of servlet config object??
jQuery in Action, 3rd edition