This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletContext access doubt

 
Brijesh shah
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll find the answer yourself in the API. Look at these classes carefully, and remember which methods they contain.
 
Swathi Sri
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic