JSF 2: possible to initialize session-scoped beans on session start?

99封情书 提交于 2019-12-12 02:45:01

问题


Is it possible in JSF 2 to initialize a session-scoped managed bean as soon as the session context is loaded? I know it's possible with Application Scoped beans and the eager attribute in the @ManagedBean annotation, but does something similar exist for session beans? I have a session-scoped bean that I want to have loaded regardless of if a specific page is visited.


回答1:


Are you sure you need a bean? If it is some general initialization stuff, you can use a HttpSessionListener, and on sessionCreated(..) initialize things.



来源:https://stackoverflow.com/questions/7960065/jsf-2-possible-to-initialize-session-scoped-beans-on-session-start

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!