aspose file tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Servlet Context Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "Servlet Context" Watch "Servlet Context" New topic
Author

Servlet Context

Mark Beavis
Ranch Hand

Joined: Apr 07, 2005
Posts: 43
Hi all -

In the Section 3 quiz of Marcus' study guide. Question 5 is as follows:

Which of the following statements are true?
a. Every (non distributed) web application has only one instance of ServletContext
b. Every instance of HttpServlet has only one instance of ServletContext
c. The ServletContext object is retrieved via the getServletContext method of ServletConfig
d. The ServletConfig object is retrieved via the getServletConfig method of ServletContext

A and C are listed as the correct answers.

My question is that shouldn't B also be correct. Isn't the ServletContext available to the servlet via the getServletContext() method?

Thanks
Mark
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
i agree


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14669
    
  11

Maybe the author intended to ask if every servlets has access to only one common context, which would be wrong in a distributed environment.
Maybe a subtle difference between "each instance of" and "every instance of"...


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Servlet Context
 
Similar Threads
Mock Question Doubt
ServletContext
marcus green mock exam
HFS p825 Q49
ServeltContext object