Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletContext Doubt

 
siva chaitanya
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What does this statement do and what is the use of ServletContext i know context information shared by multiple servlets but the following code i cant able to understand
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi siva,

this refers to the current object and getServletContext() Returns a reference to the ServletContext in which this servlet is running.


There is one context per "web application" per Java Virtual Machine


So it will return the context of current object.

Regards
jatan
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

----> this refers implicit parameter . you dont require to specify in general.


you cant do (1) as well as (2) .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic