• 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

Where does servletContext object get passed onto

 
Ranch Hand
Posts: 124
C++ Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I know that when a servlet config is created it is passed onto the init method.. However i am a bit confused about servlet context. When a servletcontext is created where is that passed i dont think its the init method as the init accepts only a servlet config object.?? and what happens when both a servlet config and aservlet context are to be passed to a servlet ?? wasnt it suppose to have a method like init(Servletconfig,servletcontext) or something like that ?? I hope someone could help me out clarify this concept... Thanks..
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Adam Zedan wrote: what happens when both a servlet config and aservlet context are to be passed to a servlet ?? wasnt it suppose to have a method like init(Servletconfig,servletcontext) or something like that ?? I hope someone could help me out clarify this concept... Thanks..



Adam,

You dont have to do that. you can get the ServletContext from servletconfig.getServletContext() method. Please refer to the java docs.

http://download.oracle.com/javaee/6/api/javax/servlet/ServletConfig.html

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic