简体   繁体   English

JSF View Scope不会关闭

[英]JSF View Scope does not shutdown

First: 第一:

I have two Managed Beans. 我有两个Managed Bean。

Bean A: 豆A:

  • @ViewScope @ViewScope
  • Contains a lazyloading datatable depending on some session value, initialized in the @PostConstruct 包含一个延迟加载数据表,具体取决于某些会话值,该值在@PostConstruct中初始化

Bean B: 豆B:

  • @ViewScope @ViewScope
  • Changing the session value which is used in Bean A 更改在Bean A中使用的会话值

I do following; 我照做;

  • setting my session data with the JSF site using Bean B 使用Bean B在JSF站点上设置我的会话数据
  • loading the jsf site which uses Bean A 加载使用Bean A的jsf网站
  • setting other session data with Bean B 使用Bean B设置其他会话数据
  • loading the jsf which uses Bean A again 再次加载使用Bean A的jsf

The Problem is following: 问题如下:

If I am loading the JSF site with Bean A again, the PostConstruct which is initializing the datatable is not loaded again. 如果我再次使用Bean A加载JSF站点,则不会再次加载初始化数据表的PostConstruct。

I thought that if I use the view scope, the ManagedBean would be destroyed if I navigate through different JSF sites. 我以为如果使用视图范围,则在不同的JSF站点之间导航时,ManagedBean将被破坏。

Please help me to understand this Problem. 请帮助我了解此问题。 What am I doing wrong? 我究竟做错了什么?

It should yes. 应该是。 The view scope should stay in-tact for as long as you stay on the same view. 只要您停留在同一视图上,视图范围就应该保持完整。

There have been many problems with this scope in past versions of JSF however, including relating to PostConstruct; 但是,在过去的JSF版本中,此范围存在很多问题,包括与PostConstruct有关的问题; which version are you using right now? 您正在使用哪个版本? It should mention that in the logs during application startup. 应该在应用程序启动期间的日志中提及。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM