Scopes in adf shows the life time of an object.
1. Request Scope :-
When the object or variable is set to a request scope then that object is available between one request-response cycle.
Example :-
When a client sends the HTTP request and an object is assigned to a request scope then that object life sustain until the client received the response for a given response.
Syntax to set the variable in request scope :-
AdfContext.getCurrent().getRequestScope().put("requestVariable", "value asign to this requestVariable );
2. BackingBean Scope :-
There is a confusion to compare this scope with request scope.So to clear this, Backing Bean scope is limited to the page. It just renders the content on the page without going to the new page.
Mostly we use BackingBean Scope in displaying Task flow's as regions in a page.
3. Page Flow Scope :-
It is also called as Task Flow Scope.This scope sustain across all the pages in a bounded task flow.
When object/variable is set to page flow scope then that object will be accessible within the page as well as to all the pages in a single bounded task flow.
Syntax to set the variable in page flow scope :-
ADFContext.getCurrent().getPageFlowScope().put("myVariable", "value assign to myVariable");
OR
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("myVariable", "value assign to myVariable");
4. View Scope :-
It is also called as page scope.When object is set to a view scope then that object is available until the view id of current view changes.
Syntax to set the object in view scope :-
ADFContext.getCurrent().getViewScope().put("myVariable", "value assign to myVariable");
OR
AdfFacesContext.getCurrentInstance().getViewScope().put("myVariable", "value assign to myVariable");
5. Session Scope :-
The object is available for the duration of the session.
For Example :
When a user login into a system then that object is available until user will logout to the system.
Syntax to set object in session scope :-
ADFContext.getCurrent().getSessionScope().put("myVariable", "value assign to myVariable");
0 comments:
Post a Comment