You’ll notice that in the previous example, the JavaServer Pages still referred to the session-scoped component as NewPerson, the same as if it were globally scoped. This is because, as far as a single user is concerned, all components share the same namespace, no matter what their scope. To you, this means that you can change the scopes of components without touching any of the objects or pages that refer to those components. In theory, you could develop your entire application for a single user, then turn it into a multi-user application by selectively marking components as session-scoped. Of course, you should probably design your application as a multi-user application from the beginning, as there are many unique issues that arise in the design of a multi-user application.

If you are interested in how multiple scopes are represented within Nucleus, you can use the Component Browser to find the separate copies of the NewPerson component. If you look in /atg/dynamo/servlet/sessiontracking/SessionManager, you should see some components with strange-looking names. Those names are the identifiers for the two sessions corresponding to the two browsers that you used. Within those components, you should see separate copies of the entire component tree, and somewhere in there you will find the two NewPerson components.

When Nucleus needs to resolve a component name, it merges the global tree of components with the tree of components for a specific session. This allows the two scopes to appear in the same namespace, but still be separated in the “real” tree of components.

 
loading table of contents...