Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet context question

 
Kartik Mahadevan
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I assume that initially at the start of the servlet the container passes Servlet Config object into init() method.So we start using this servlet config whenever we want but no servlet context is provided by the container although servlet config contains a refrence to servlet context but how does the servlet context come into being .How come we have a method like getservletcontext() when servletcontext is not being passed to the servlet? Is theservletcontext internally added to the servletusing
getservletconfig().getservletcontext()ie whenever I call getservletcontext() is it internally calling getservletconfig().getservletcontext()?

Thanks and regards
M.Kartik
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your question similar to this?
http://www.coderanch.com/t/361719/Servlets/java/why-Servlet-interface-doesn-have
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kartik Mahadevan:
Hi

I assume that initially at the start of the servlet the container passes Servlet Config object into init() method.So we start using this servlet config whenever we want but no servlet context is provided by the container although servlet config contains a refrence to servlet context but how does the servlet context come into being .How come we have a method like getservletcontext() when servletcontext is not being passed to the servlet? Is theservletcontext internally added to the servletusing
getservletconfig().getservletcontext()ie whenever I call getservletcontext() is it internally calling getservletconfig().getservletcontext()?

Thanks and regards
M.Kartik


No, you are wrong. Even before servlet config, servlet context has been prepared by the container...
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic