Bookmark Topic Watch Topic
  • New Topic

About init() method (without parameters)

 
Jaideep Kshirsagar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

I have a servlet where a cache gets uploaded in init(ServletConfig config)method, due to which the servlet is taking a lot of time at start up, to show up. Would moving this code to init()(without parameters)help? when to use init()(without parameters)method anyway?

TIA.
 
Pranav Pal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Report post to moderator
You should not override the init(SevrletCofig) method.Instead you should override the init() method. Because the inherited init(ServletConfig) method calls the no-arg init() method, so only one you need to override is the no-arg version.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
We get this question often so someone took the time to write up a nice explanation in our Servlets FAQ:
http://faq.javaranch.com/java/ServletsFaq
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!