转载地址:http://hi.baidu.com/lvzhnan/item/c2a46115d235b70ad0d66d3f

jsf session 添加 获取

1、session的添加
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExternalContext extContext =facesContext.getExternalContext();
    this.session =(HttpSession)extContext.getSession(true);
    this.session.setAttribute("user", this.userName);
    
    this.session.setAttribute("currentUser", loboUser);

 

2、session的读取

   FacesContext facesContext = FacesContext.getCurrentInstance();
   ExternalContext extContext =facesContext.getExternalContext();
   HttpSession session =(HttpSession)extContext.getSession(true); 
   //mes.setMesOperator(session.getAttribute("user").toString());
   String user = session.getAttribute("user").toString();

Integer.parseInt(request.getParameter("note_id"));  

 

posted on 2012-09-25 17:30  双面煎蛋  阅读(3899)  评论(0编辑  收藏  举报