> >
> > As long as this property value is never broadcast
> > i.e. System.setProperty("myProperty", "42");
> >
>
> System properties, in the sense that we are talking about the
java.lang.System
> class, are global to the entire JVM.  Therefore, even if the statement
above was
> allowed, it would set the property "myProperty" for *all* web applications
that
> are installed in a single Tomcat instance, and would therefore cause a
name
> clash if another app also tried to set the value for "myProperty".


Are such System calls prevented (intercepted somehow) in TC?

> Context parameters, on the other hand, are unique to an individual web
> application so there are no problems with two web-apps having parameters
(or
> anything else, for that matter) with the same names.

I shall use them from now on.

<snip-paragraph:  my suggestion>

> You can use static variables for this purpose and get away with it, as
long as
> the classes involved are loaded from WEB-INF/classes or WEB-INF/lib.  The
reason
> for this is that each web application is loaded by its own class loader,
so
> statics created by such classes are visible only within the web app. I
have a
> personal bias against statics (I prefer to store global application
objects in
> the servlet context, so that they are easily visible to all servlets and
JSP
> pages in my apps).

Do you mean that you have a class, say Contants, that has a bunch of statics
(public contants and maybe methods) that is only visible to objects in a
particular
app? In which case you are still using statics - only the scope has been
narrowed,
for obviously good reasons.

>
> > Miles
>
> Craig
>
Miles

Reply via email to