2012-05-16 39 views
0

如何在會話中獲取所有初始化的託管bean? 以下代碼每次都會使JVM崩潰。如何獲取會話中的所有已初始化的託管bean?

FacesContext facesContext=FacesContext.getCurrentInstance(); 
com.sun.faces.application.ApplicationAssociate application = 
ApplicationAssociate.getInstance(facesContext.getExternalContext()); 
+0

不能使用JConsole的?這是我在搜索運行bean時使用的 – jlengrand

+0

我實際上需要讓他們通過代碼。 – Shahzeb

+0

你想獲得一個會話作用域bean在另一個?使用managedproperty ... – Daniel

回答

1

你不能使用類似

FacesContext context = FacesContext.getCurrentInstance(); 
HttpSession session = (HttpSession) context.getExternalContext().getSession(true); 
Enumeration mySessionBeans = session.getAttributeNames(); 
+0

這聽起來更像它。會嘗試:) – Shahzeb