Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting Servlet Context from Session Object  RSS feed

 
Manohar Karamballi
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai All!
Is there any way to get Servlet Context Object from Session Object?
Thanks in Advance
Regards
Manohar
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can get ServletContext from the ServletConfig provided when a servlet is initialized. Inside a servlet class use this:
getServletConfig().getServletContext() ;
If you get a null, then you didn't handle the init method properly.
Bill

------------------
author of:
 
Manohar Karamballi
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai Williams!
Thanks for your reply. But what i want is to get ServletContext Object from Session Object in some other application. Anyway i got an alternative by passing ServletContext as Constructor Parameter to that application.
Regards
Manohar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!