The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes ServletContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "ServletContext" Watch "ServletContext" New topic


Abir Majumder

Joined: Dec 06, 2008
Posts: 3
Is it possible to get ServletContext from HttpServletRequest?
Peter Purmonen

Joined: Oct 24, 2008
Posts: 9
Yes, via request.getSession(true).getServletContext(), assuming the code executes within a servlet context.
Abir Majumder

Joined: Dec 06, 2008
Posts: 3
thanks peter. I checked HttpSession api. That method is there. Please clarify.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60739

"Abir", please check your private messages for an important administrative matter.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: ServletContext
Similar Threads
full path
Obtain ServletContext from Request
Class or interface
What is the name of the object that is created/maintained by the Servlet Container and contains all