File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes doubt about servlet context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "doubt about servlet context" Watch "doubt about servlet context" New topic

doubt about servlet context


Joined: Mar 28, 2005
Posts: 23
Can anyone please tell how retrieve servlet context object?
Sergey Tyulkin
Ranch Hand

Joined: May 10, 2005
Posts: 87
You can retrieve ServletContext object by ServletConfig.getServletContext() method.
The ServletConfig object is passed to the init() method of the servlet.
More over, GenericServlet itself implements ServletConfig interface, and you can simply cal getServletContext() method as is in you servlet methods (doGet, doPost an so on)

Joined: Mar 28, 2005
Posts: 23
Thank you
I agree. Here's the link:
subject: doubt about servlet context
It's not a secret anymore!