aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
Get rid of line numbers
ServletContext within ServletConfig
getServletConfig() and getServletContext()
access the servlet init config parameters using jspInit()
Servlet concepts doubts