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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "ServletContext  access doubt" Watch "ServletContext  access doubt" New topic
Author

ServletContext access doubt

Brijesh shah
Ranch Hand

Joined: Mar 16, 2007
Posts: 90
41.The ServletContext object are accessible from which of the following objects?
Please select three correct answers.
A.HttpServlet
B.GenericServlet
C.HttpSession
D.ServletConfig
E.ServletResponse


The above Question i got from moxk exam in which they have given correct answer as A , C and D... But i think answer should be C, D and E...So please explain me if i'm wrong.

Thanks;
Brijesh
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You'll find the answer yourself in the API. Look at these classes carefully, and remember which methods they contain.


[My Blog]
All roads lead to JavaRanch
Swathi Sri
Greenhorn

Joined: Jan 18, 2007
Posts: 22
Hi,

Based on following API info, Answer should be A,B,C and D.
There are 4 correct options instead of 3.

http://java.sun.com/webservices/docs/1.4/api/javax/servlet/GenericServlet.html
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSession.html
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServlet.html
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletConfig.html
all have getServletContext() method, which proves ServletContext is accessible.

and

http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletResponse.html
does not have getServletContext() method..

Please correct me if I am wrong.

Regards,
Swathi.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ServletContext access doubt
 
Similar Threads
For JSP scopes of request and page, what type of object is used to store the attribut
ServletContext object
www.jiris.com exam blunder
Behaviour of distributed web application.
ServeltContext object