File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes ServletContext Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ServletContext Doubt" Watch "ServletContext Doubt" New topic
Author

ServletContext Doubt

siva chaitanya
Ranch Hand

Joined: Jul 05, 2011
Posts: 59

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

Joined: Jul 23, 2008
Posts: 296

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

Joined: Jan 28, 2008
Posts: 5575


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


you cant do (1) as well as (2) .
 
 
subject: ServletContext Doubt
 
Similar Threads
calling value from servlet in jsp
Problem in Using Servlet Context
ServletContext and RequestDispatcher?
How can a RequestDispatcher call a servlet in another web application?
Context param values from web.xml