日期:2014-05-16  浏览次数:20373 次

在 JSF 的 Managed Bean 中获得request session对象
request:
------------------------------------
FacesContext context = FacesContext.getCurrentInstance();
ExternalContext ec = context.getExternalContext();
HttpServletRequest request = (HttpServletRequest) ec.getRequest();


session:
------------------------------------
FacesContext context = FacesContext.getCurrentInstance();
ExternalContext ec = context.getExternalContext();
HttpSession session = (HttpSession) ec.getSession(true);


http://stenlylee.iteye.com/blog/317186