• 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

At what point of time servletContext object is created

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At what point of time servletContext object is created .Is it during srever start up?
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
servlet context is a common object every application has and share among its components.
Hence it is loaded when the application is loaded in the container
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Step:1 Container will load Servlet.class
Step:2 Container will invoke the default constructer(i.e instantiate to your Servlet.class)
Step:3 container invokes the init() method
but before invoking this init method it will create 2 ojects:
a. servletConfig
b. servletContext

If you have any init-param(for servlet config i.e specific to any servlet) in your web.xml then it will create an object holding the reference and wll pass the reference to the servletConfig object.

Similarly if you have some info that will be shared by whole applicatin(li database url,usrname,pwd) ,then a it will create an object and pass the reference to the servletContext.

Once these 2 object references are created then the init() is called.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic