10 March, 2019

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope.
There are five scopes in ADF (Application, Request, Session, View and PageFlow).
The below code snippest explains how to get value of each variable scope.

        AdfFacesContext adfCtx = AdfFacesContext.getCurrentInstance();
                
        //Page Flow Scope
        Map pageFlowMap  = adfCtx.getPageFlowScope();
        Object pageFLowVariable = pageFlowMap.get("VARIABLE_NAME");
        
        //View Scope
        Map viewMap  = adfCtx.getViewScope();
        Object viewVariable = viewMap.get("VARIABLE_NAME");
        
        //Session Scope
        HttpServletRequest request =
            (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
        HttpSession session = request.getSession(false);
        Object sessionVariable = session.getAttribute("VARIABLE_NAME");
        
        //Request Scope
        Object requestVariable = request.getAttribute("VARIABLE_NAME");
        
        //Application Scope
        Map applicationMap = FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();
        Object applicationVariable = applicationMap.get("VARIABLE_NAME");




Thanks

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope. There are five scopes in ADF (Application, Request, Session, View and PageFl...