JBridge

JBridge: Certification Question Of The Day

JBridge Home >> Certification Questions >> Question for Wednesday May 21st 2003 Wednesday May 21st 2003
Which of the following interfaces and classes do NOT have a method (directly or through inheritance) for retrieving the ServletContext?

A HttpSession
B ServletConfig
C HttpServlet
D GenericServlet
E Servlet
F ServletRequest
Page down for the answer...











































The Answer

E and F are the correct answers.
GenericServlet implements ServletConfig, which contains a getServletContext() method. HttpServlet inherits from GenericServlet, so also contains this method by virtue of its parent. HttpSession also containst a getServletContext() method. This covers choices A through D.
Servlet is an interface also implemented by GenericServlet - but doesn't contain the getServletContext() method.
ServletRequest doesn't contain a getServletContext() method (and why should it?).


EMail: dbridgewater@jbridge.co.uk
Phone: +44 (0)1943 877414
Fax: +44 (0)1943 877414
Mail: David Bridgewater, Willow Dene, Bradford Road, Menston, Ilkley, West Yorkshire, LS29 6ED, UK
Copyright © 2003 David Bridgewater. All rights reserved.