About ServletConfig

Hi all,(I am new to JavaI attended a interview they asked me why we pass servletconfig in init method?plz reply for this I am a new one to java
[178 byte] By [sneka] at [2007-9-30 17:34:04]
# 1

We don't pass the config object - The container (server ) passes it.

When the servlet is loaded the container calls the init method of the servlet and passes an implementation of servletconfig as a parameter. The container would have read init-parameters etc specified in the web.xml into the servletconfig object, so that in the servlet once you get hold of the config object, you can make use of that data.

jSweep at 2007-7-6 13:57:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...