What is the need of a special ServletConfig object for every servlet

What is the need of a special ServletConfig object for every servlet ?

Let me be more precise . If it is only to get the initial parameters ,then i can do the same inside a servlet also . I can make a data member in my extended Servlet class like :-

publicclass MyServletextends HttpServlet

{

String name;

}

And i can initialize that member in the overridden init() method of the MyServlet class .

Again from my SertvletConfig i can get a reference to ServletContext . But straight way by using getServletContext() method inside the servlet a can get the same .

Then why i need a special ServletConfig object for every servlet ?

I am looking for something which is more specific for the ServletConfig object .In other word that function can only be done by the ServletConfig object . Pls reply soon .

With regards

Arunabh Dash

[1056 byte] By [jublua] at [2007-10-3 9:19:24]
# 1

The ServletConfig object is passed by the container to the GenericServlet object when the container initializes the Servlet. The HttpServlet class extends the GenericServlet class and offers convenience methods for accessing the information in the ServletConfig object.

So when you say "i can do the same inside a servlet also", this is not strictly true. You are calling a method in the HttpServlet class that in turns calls a method in the ServletConfig class. You are still using the ServletConfig. It has just been abstracted away to save on typing (eg getInitParameter instead of getServletConfig.getInitParameter)

tolmanka at 2007-7-15 4:32:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
So is it like when ever i am calling a method on the servlet then i am calling it throw ServletConfig .Arunabh
jublua at 2007-7-15 4:32:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...