jsf session的获取和添加

转载地址: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"));  
原文地址:https://www.cnblogs.com/susuyu/p/2701902.html