I want to ask if i place my managed bean in session scope, then it is stored in session\' Like if i have a bean like this
@ManagedBean
@SessionScoped
public
They're stored in the view map as available by UIViewRoot#getViewMap():
Map<String, Object> viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap();
ViewScopedBean viewScopedBean = (ViewScopedBean) viewMap.get("viewScopedBean");
// ...
Equivalently, you should be using the session map abstraction as well which is available by ExternalContext#getSessionMap() (you ultimately want to have zero javax.servlet
import declarations throughout your JSF code):
Map<String, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
SessionScopedBean sessionScopedBean = (SessionScopedBean) sessionMap.get("sessionScopedBean");
// ...
Unrelated to the concrete problem, this may not be the best way. Look at @ManagedProperty if possible.