Two Laptop Bag
The moose likes Servlets and the fly likes ServletConfig Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ServletConfig Interface" Watch "ServletConfig Interface" New topic

ServletConfig Interface

Pandurangan Rakesh

Joined: Jun 06, 2004
Posts: 24

What's the ServletConfig Interface used for?In init method of servlet what the Servletconfig object contains?

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
The best place to learn the answer is in the JavaDocs provided in any Tomcat installation. There are also a number of good tutorials on the web, do a google search for "Java Servlet Tutorial"
Jeff Walker
Ranch Hand

Joined: Apr 25, 2004
Posts: 116
Bills right, you need to go and read about servlets.

But in a nutshell, it essentially allows you to retrieve configuration parameters from the web.xml file, for your particular servlet. (Each servlet in a web app can be initialized differently). Hence the name, "Servlet Configuration" shortened to ServletConfig.

As opposed to the ServletContext interface, which really represents the servlet container to any servlet in the web app. The object that implements the ServletContext will be the same for all servlets within a web app, and so all servlets can get a copy of it and it will be the same for all of them.

I would recommend "SCWCD Exam Study Guide" by Deshmukh and Malavia. It's a classic now for studying for the SCWCD exam, but it's very useful for general brushing up on servlets and JSPs.

Jeff Walker
Pandurangan Rakesh

Joined: Jun 06, 2004
Posts: 24
Thanks Lot..I am clear now
I agree. Here's the link:
subject: ServletConfig Interface
It's not a secret anymore!