FAQ@SaveState的用法@SaveState声明一个域的状态需要被保存。inServer属性表示是否将此域保存到服务器中(false表示保存到客户端),如果inServer为true则保存到SESSION中。@SaveState 一般用在REQUEST的LiteBean中。用法如下: @SaveState private int count = 0; 如何销毁sessionSessionBean.java
FacesContext context = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession)context.getExternalContext().getSession(false);
session.invalidate();
AOM存取session的两种方法第一种 FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(key, value); FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(key); 第二种
HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
session.setAttribute(name, value);
session.getAttribute(name);
|