• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Mock Question Doubt  RSS feed

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following statements are true?
Choose at least one answer.
A. Every (non distributed) web application has only one instance of ServletContext Correct
B. Every instance of HttpServlet has only one instance of ServletContext Incorrect
C. The ServletContext object is retrieved via the getServletContext method of ServletConfig Correct
D. The ServletConfig object is retrieved via the getServletConfig method of ServletContext Incorrect

my question is why is option 2 is wrong.(It is from examulator.com)
 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Looks like a mistake to me.

Could it be the question is badly worded?
"Every instance of HttpServlet has only one instance of ServletContext" could be read as
a) Every single instance points to one and only one instance of a ServletContext object (i.e. they don't contain a map of them, just a reference to one, which would be true)
b) Every single instance points to the exact same ServletContext (which would be false for distributed applications).

Make sense?

MG
 
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its because if the web application is in a distributed environment then each servlet will have one ServletContext per JVM
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!