Hello Friends, I am till date was using init(SertvletConfig config) method for servlet initialization. Well this method is overloaded and it has no arguments. Thai is init(). Can any one tell me where to use the other init method and what is the diff between the two. Thanks, Regards, Raj.
Regards,<P>Raj.<BR>-------------------------<BR>Afforts should be Appriciated.<BR>-------------------------
The init() method is provided as a convenience method in the GenericServlet class. GenericServlet has an init(ServletConfig conf ) method as required by the Servlet interface. If you don't override init(ServletConfig conf), then the GenericServlet method will be called - it in turn calls the init() method. So which one to choose is up to you. Personally I prefer to override init( ServletConfig conf) because it makes clear what is happening and because I usually need to retrieve init parameters from the ServletConfig anyway. Bill
Bill, You are the author of several well known books, so I reckoned you would probably be a good source to ask a couple of very common questions to. 1.) What's the best way to break into Java development? Note: I already have my SCJP 2.) What area(s) of Java do you see demand being the highest in the near future(Next two years). Regards, Travis M. Gibson SCJP
Regards,<BR>Travis M. Gibson, SCJP<BR>Java Developer<BR>www.travismgibson.com<BR>firstname.lastname@example.org
Joined: Aug 26, 2000
William, thanks for you're explanation on init(0 and init(ServletConfig config) method. I would like you to see the posting in th same forum thread title "Pl help me with this href portion in this code Dipanjan Paul 5 November 27, 2000 11:39 AM "
Here Paul was using init() method and was not able to access his database and was getting NullPointerException. When i changed the method it worked fine....Why like this....pls explain me what was going in the two cases. Why it didn't worked for init() method. Regards, Raj.
subject: Difference between init() and init(ServletConfig config) methods