JSF 应用程序范围的 bean 不保留信息
我正在尝试使用应用程序范围的 bean,但每次我调用延迟初始化的 getter 方法时,它都会再次初始化这些值。我已使用调试器来确认每个新调用(即使是同一会话)中的值再次为空。我使用的应用程序范围错误吗?
<managed-bean>
<managed-bean-name>locationBean</managed-bean-name>
<managed-bean-class>com.model.LocationBean</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
I am trying to use an application-scoped bean but every time I call the lazily initialized getter methods, it initializes the values again. I've used the debugger to confirm that the values are null again on every new call (even by the same session). Am I using the application-scope wrong?
<managed-bean>
<managed-bean-name>locationBean</managed-bean-name>
<managed-bean-class>com.model.LocationBean</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有正确调用该豆。修复后,它工作正常。抱歉浪费您的时间,请随时删除此问题。
I was not calling the bean properly. After fixing that, it worked properly. Sorry for wasting your time and feel free to delete this question.