| Author |
init(servletconfig)
|
Rajendra Prakash
Ranch Hand
Joined: Sep 10, 2009
Posts: 293
|
|
|
My interviewer asked .which method to be used, either init() or init(servletconfig) or both in generic servlet .
|
 |
Pramod P Deore
Ranch Hand
Joined: Jul 15, 2008
Posts: 629
|
|
|
init(servletconfig) is available in Servlet interface and init() is available in GenericServlet class. GenericServlet implements Servlet interface, so both can be used in GenericServlet
|
Life is easy because we write the source code.....
|
 |
Manish Singh
Ranch Hand
Joined: Jan 26, 2007
Posts: 160
|
|
both init() and init(servletconfig) can be used.
But you should use the init() because init(servletconfig) saves the servlet config in an instance variable.
And the sole purpose of init() method is to be overrided be the subclass if needed.
|
 |
Rajendra Prakash
Ranch Hand
Joined: Sep 10, 2009
Posts: 293
|
|
if i override servletconfig() in init() means ,it gives configuration information from server to servlet.
Cofiguration information means can i say about struts-config.xml or hibernate.cfg.xml or something else.
I mean what configuration information you get during initialization.
|
 |
Fidel Edwards
Ranch Hand
Joined: Mar 19, 2008
Posts: 202
|
|
Please refer Servlet FAQ
and ServletConfig
|
God Gave Me Nothing I Wanted, He Gave Me Everything I Needed.
|
 |
 |
|
|
subject: init(servletconfig)
|
|
|