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 object

 
naresh govindaswmay
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
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


Here i have selected A,B and D answer.but they told A,C and D is the answer.Please anybody clear this doubt.I am waiting for the updates.
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method from the HttpSession exists but is depreciated from version 2.1 and should not used anymore.

Generic servlet is a abstract class and can not be initialized but implements the servlet interface. The HttpServlet uses the inherited method from Generic Servlet for getting the ServletContext getServletContext.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method from the HttpSession exists but is depreciated from version 2.1 and should not used anymore.

Is it ? Please check that statement again.
 
James Mark
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ServletContext object can also be obtained from
public ServletContext getContext(java.lang.String uripath) method in the
ServletContext interface
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic