Saturday, 14 December 2013

Working with different scopes in ADF

This blog we will see how to use the different scopes like Application Scope, PageFlow Scope, Session Scope, Request Scope in ADF.

Request Scope:

FacesContext fcx =FacesContext.getCurrentInstance();
 

// Set Into Request Scope value
ExternalContext exCntx =fcx.getExternalContext();
exCntx.getRequestMap().put("key","value");
 

//get Request Scope value
ExternalContext exCntx =fcx.getExternalContext();
exCntx .getRequestMap ().get("key");


Application Scope:

FacesContext fcx =FacesContext.getCurrentInstance();
 

// Set Into Application Scope value
ExternalContext exCntx =fcx.getExternalContext();
exCntx.getApplicationMap().put("key","value");
 

//get Application Scope value
ExternalContext exCntx =fcx.getExternalContext();
exCntx . getApplicationMap ().get("key");


Session Scope:

FacesContext fcx =FacesContext.getCurrentInstance();


// Set Session Scope value
ExternalContext exCntx =fcx.getExternalContext();
exCntx.getSessionMap ().put("key","value");


//get Session Scope value
ExternalContext exCntx =fcx.getExternalContext();
exCntx . getSessionMap ().get("key");


PageFlow Scope:

// Set Into PageFlow Scope value
RequestContext.getCurrentInstance().getPageFlowScope().put("key","value);
 

// Get PageFlow Scope value
RequestContext.getCurrentInstance().getPageFlowScope().get(name);


Thanks..

1 comment: