Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我正在开发一个 JSF 项目,我想直接在我的 xhtml UI 页面上访问一些会话级变量,而不使用任何托管 bean。
只是想知道这是否可能,如果是,那么如何?
谢谢
是的,有可能
如果 bean 不退出,则先将其放入会话中
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(key,object);
并在 xhtml 页面上使用 bean 使用
<h:outputText value="#{sessionScope.key}" />