jsf的在Bean中怎么赋值request.setSession("","")?
展开全部
FacesContext context = FacesContext.getCurrentInstance();
ExternalContext ec = context.getExternalContext();
HttpServletRequest request = (HttpServletRequest) ec.getRequest();
request.setSession("test","test");
HttpSession session = (HttpSession) ec.getSession(true);
System.out.println(session.getAttribute("test"));
ExternalContext ec = context.getExternalContext();
HttpServletRequest request = (HttpServletRequest) ec.getRequest();
request.setSession("test","test");
HttpSession session = (HttpSession) ec.getSession(true);
System.out.println(session.getAttribute("test"));
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询