• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

super.init(config) in servlets

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all

by super.init(config) we can get
intialization parameters and
we can place variables which should be initialized once other than this is there any need of super.init(config) in servlets?

thanks in advance
saiprasanna
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In servlets, if you override the init() method, you'll have to store the ServletConfig somewhere. You can either
1. Declare a ServletConfig class member
2. Or let the parent class store it, by calling super.init(config)
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
init(ServletConfig config) -
1. Called by Sevlet Container to indicate that the servlet is ready for service.
2. The implementation of this method in GenericServlet stores ServletConfig for later use, which can be retreived later using getServletConfig().
3. When overriding this method, call super.init(config). However, instead of overriding this method it is better to override init(). init() will be called from init(ServletConfig), and you won't need to to call super.init(config).
4. init(ServletConfig) is called once after instantiating servlet.
reply
    Bookmark Topic Watch Topic
  • New Topic