Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ServletContext  RSS feed

 
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: 65893
135
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!