• Post Reply Bookmark Topic Watch Topic
  • New Topic

ServletContext

 
Abir Majumder
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Is it possible to get ServletContext from HttpServletRequest?
thanks
 
Peter Purmonen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, via request.getSession(true).getServletContext(), assuming the code executes within a servlet context.
 
Abir Majumder
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks peter. I checked HttpSession api. That method is there. Please clarify.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65667
129
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Abir", please check your private messages for an important administrative matter.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!