I'm pretty sure its Chapter 10 "Developing thread-safe servlets" that will explain things pretty well. Basically if you have a distributed web application (using more than one JVM) -- you'll get one ServletContext per JVM. And yes, that's mandatory. From the Servlet 2.3 spec: SRV.10.6 "Distributed Containers" In distributed web containers, HttpSession instances are scoped to the particular VM servicing session requests, and the ServletContext object is scoped to the web container's VM....
I do agree with Jessica. There is one instance of ServletContext per JVM in a distributed web application, but default web application (ROOT in case of Tomcat) has only one instance among multiple JVMs in a distributed environment. At this stage, Tejas Tambe, you will get confused. Give a through read of the entire book, surely you will understand in later chapters. Don't worry about this at this stage. Your question is answered in the book.
posted 17 years ago
Thanks, Jesica n Venkat
Cob is sand, clay and sometimes straw. This tiny ad is made of cob: