Oracle ATG Component Scopes
Oracle ATG has 5 different scopes that can be used to application components:
- Global – Global scope in Oracle ATG is used when we want to share the component with all users.
- Session: Session scope in Oracle ATG is used when we want each user visiting the site has to be provided with separate instances.
- Request: Request scope in Oracle ATG is used when we want each active request coming to site should be provided with a separate instance.
- Window: Window scope in Oracle ATG is used when we want each browser window should be provided with separate instance of teh component.
- Prototype: Window scope in Oracle ATG is used when we want each resolve of a atg component needs to provided with separate instances of the component.
How to define the Component Scopes in Oracle ATG?
$scope property is the convention used to define the components scope. This property can be set to – global, session, request, or window.
For example, to set the NewStudent component to session scope we need to define as shown below:
config/com/technostixs/student/NewStudent.properties $class=com.technostixs.student.Student $scope=session fname=Eric Menon lname=Menon age=25 firstname.lastname@example.org
We need to specify the scope of the that we want the behavior to be. If $scope property is not set explicitly, thenit is by default the scope of such component is considered to be global
If a component?s $scope property is not explicitly set, it automatically has global scope
Few rules to be followed while defining scope of a component:
A component can have properties pointing to objects/components whose scope is equal to or greater than its own.
Example: request scoped component can have properties pointing to objects of scope (any scope) request, session or global.
session scoped component can have properties pointing to objects of scope session and global.
global scoped component can have properties pointing to objects of scope global.
You may also like this
ORACLE ATG ENDECA & JAVA TECHNOLOGY XCHANGE SYSTEM. TechnoStixs.com is a dedicated weblog for Oracle ATG, Oracle Endeca, Java/J2EE and web developers. We take pride in our work. Every publication is carefully analyzed, written and tested to ease the understanding of the topic or subject.
We cover Oracle ATG, Oracle Endeca, Java Core Technologies, eCommerce, J2EE Frameworks, Web Service, Build Tools, Unit Test Frameworks and Others.
2,499 total views, 2 views today