You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sri Sankaran <Sr...@sas.com> on 2002/11/01 22:45:24 UTC

[OT] static vs. application scope

What is the difference between making a property available in application scope as opposed to making it static to a class?  As a simple (contrived) example, I want to maintain a mapping of car model and manufacturer.  This being, un-changing I could implement it as a static property of some class.

public class SomeClass {
  private static Map carInfo;
}

This will be available to *all* sessions -- since all sessions are "hosted" by the same VM (isn't that true -- or is that dependent on the container?).

I could, alternatively, maintain such information in the servlet application context.

What is the difference?

Sri