wood burning stoves 2.0*
The moose likes Servlets and the fly likes Servlet context  question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet context  question" Watch "Servlet context  question" New topic
Author

Servlet context question

Kartik Mahadevan
Ranch Hand

Joined: Feb 16, 2005
Posts: 47
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

Joined: Mar 06, 2001
Posts: 13459

Is your question similar to this?
http://www.coderanch.com/t/361719/Servlets/java/why-Servlet-interface-doesn-have
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet context question
 
Similar Threads
getServletConfig() and getServletContext()
ServletContext within ServletConfig
Servlet concepts doubts
access the servlet init config parameters using jspInit()
Get rid of line numbers