Tuesday, October 30, 2012

How to store values into various scopes in ADF

Subject :  How to store various values into various scopes(Application, PageFlow, Session, Request) in ADF

Solution

Setting values into various scopes


FacesContext fx =FacesContext.getCurrentInstance();

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

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


// Set Into Session Scope
ExternalContext exContext =fx.getExternalContext();
exContext.getSessionMap().put("key","value");


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

Retrieving Values.

RequestContext.getCurrentInstance().getPageFlowScope().get(name);

exContext.getApplicationMap().get("key");


No comments:

Post a Comment