aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Defaul ServletContext ...??? Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Defaul ServletContext ...??? Question" Watch "Defaul ServletContext ...??? Question" New topic
Author

Defaul ServletContext ...??? Question

Leandro Melo
Ranch Hand

Joined: Mar 27, 2004
Posts: 401
Hi.
What's exactly a default servlet context? How do I configure it?
This is a question from jdiscuss about this.

-----------
Assuming that the servlet container is distributed across multiple JVMs, which of the following statements are correct? (Select 2 correct options.)

1 - A separate instance of a non-default servlet context will be available on each of the JVMs.

2 - A separate instance of all servlet context will be avaible on each of the JVMs

3 - The default servlet context will be present only on one of the JVMs.

4 - There is only one instance of servlet contexts across all the JVMs.

5 - None of the above.

Option 1 and 3 are actually the specification of the behaviour of ServletContexts.
Default servlet context is provided to servlets that are not deployed as a part of some webapplication. They are considered to be a part of "default" webapplication.


Leandro Melo
SCJP 1.4, SCWCD 1.4
Osama Hasan
Ranch Hand

Joined: Sep 30, 2002
Posts: 53
Hi!
There is one default web application in the servlet container. In Tomcat, the directory named ROOT refers to the default web application. The servlet context of this web application is called the default servlet context.


SCJP 1.4<br />SCWCD 1.4
amit taneja
Ranch Hand

Joined: Mar 14, 2003
Posts: 810
Originally posted by Osama Hasan:
Hi!
There is one default web application in the servlet container. In Tomcat, the directory named ROOT refers to the default web application. The servlet context of this web application is called the default servlet context.


so what is the final answer from list of choices and why ?


Thanks and Regards, Amit Taneja
Osama Hasan
Ranch Hand

Joined: Sep 30, 2002
Posts: 53
The correct answers as mentioned in the first post are 1 and 3. The Java Servlet specification guarantees that in a distributed environment each web application has one Servlet Context on each JVM except the default web-application whose Servlet Context exists on only one JVM.
Hope it helps.
Sumeet Raheja
Greenhorn

Joined: Dec 01, 2004
Posts: 16
Servlet Context is one per application with in one JVM , but in distributed application Servlet Context is per JVM. That means if one Application is distributed among two JVM then there will be 2 Servlet Context in total, one per JVM
Leandro Melo
Ranch Hand

Joined: Mar 27, 2004
Posts: 401
Hi Sumeet, we're talking here not about "the" servlet context, but specifically about the "default" servlet context.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Defaul ServletContext ...??? Question