07 June, 2012

Setter and Getter of Session Parameters in ADF

We usually use session parameters as global variables that is still alive for entire session.

I will produce today the getter and setter of session parameters.

Setter of Session Parameters 
   public void setSessionParameter(String name, Object value) {  
     HttpServletRequest request =  
     HttpSession session = request.getSession(false);  
     session.setAttribute(name, value);  

Getter of Session Parameters
   public Object getSessionParameter(String name) {  
     HttpServletRequest request =  
     HttpSession session = request.getSession(false);  
     return session.getAttribute(name);  

Don't forget to import below classes in your custom class
 import javax.faces.context.FacesContext;  
 import javax.servlet.http.HttpServletRequest;  
 import javax.servlet.http.HttpSession;  

If you have your custom framework for
getter of FacesContext
getter of ExternalContext
getter of Session

then you should replace my code to get these objects by your methods you use in your custom framework.

Mahmoud A. El-Sayed

1 comment:

  1. Ιf Kіds lіκe actіng οnlіne gameѕ аnd then
    they will be trackѕ fгom which tо Select.
    Flag аs wеll іncludeѕ
    a full fеatureԁ MMОRPG Reсeiѵе pасkеd ωith inѕtanсed іt and ѕhоws
    a animated cartoоn ρіctuгe οf what іt lοοks Like.
    Nо one enjοуs losing аll the sеntenсe, but
    inѵеntiνenesѕ of thе biz is
    nοt that far off from otheг games liκе it.

    Rеνiеw my web site: www.telanganafb.com


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...