I would have preferred it if this had continued in the same
thread, but never mind...
Yes, I see how you are looking at this question now. Indeed, since context initialisation parameters are immutable once set in the deployment descriptor, then
assuming the same DD is deployed to each server, the same set of parameters will be available to each application.
So provided they are
exactly the same application deployed on different machines, then the context parameters will be available to every component of each instance of the application.
But, and this was what I was implying, the context parameters are never
migrated between different JVMs... Aleksander's comment was "so Servlets in second JVM will not have access to context param of ServletContext in first JVM". If we're talking about objects this is correct - servlets in one application can't invoke methods on context parameters in a different application. This is of course a different story to session attributes, whose instances can effectively be cloned between the two applications and any change in state between invocations are persisted.
However, assuming the applications are deployed in the same way, they should each contain the same set of context parameters. Since these are immutable, they contain the same data and so each application has access to identically named parameters with identical values. But these are not the
same parameters in the object sense... method invocations on either occur quite separately.
Of course, a change in the deployment descriptor would also lead to each application having access to different parameters (and in theory this could happen if you had different Deployer personnel for different Web servers). Indeed, what would happen if your DD contained a host name and configuration for a mail server? This would most likely be different on each machine the application was deployed on, so even though the same parameter names appear, they have different values. But other applications can't 'see' the different values - they can only determine their own. So the context parameters are available in all applications, but they have different values.
Again, this is an esoteric argument of words, which is why both answers can be seen to be correct, depending on how you want to interpret the conditions, and what exact restrictions are given. In my opinion the question is quite unclear. Indeed, I could argue that in fact option D ("It is accessible only in the init() method of the servlet") is true if we choose never to save the ServletConfig object in the servlet... no ServletConfig object means no ServletContext object is available for use in any other methods of the servlet, so no access to context parameters elsewhere! This would have been better worded as "It is only
ever accessible in the init() method of the servlet" which is then clearly false.
That might have made things more confusing, I don't know...
[ May 11, 2006: Message edited by: Charles Lyons ]