File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Where does servletContext object get passed onto Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Where does servletContext object get passed onto " Watch "Where does servletContext object get passed onto " New topic
Author

Where does servletContext object get passed onto

Adam Zedan
Ranch Hand

Joined: Jun 10, 2011
Posts: 124

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..


Don’t look where you fall, but where you slipped
bhanu chowdary
Ranch Hand

Joined: Mar 09, 2010
Posts: 256
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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where does servletContext object get passed onto