基本上相同的问题作为hereJSF 2.0 @ViewScoped重定向(导航)来定位=“_空白”
如何保留页面上的ViewScoped豆从中我重定向到一个不同的浏览器标签:
firstPage.xhtml:
<h:commandLink action="#{controller.redirect}" value="#{bean.value} target="_blank"/>
当重定向/导航与初始化其他豆类完成,它破坏过程中的这#{豆}。在重定向的代码中,我甚至没有使用#{bean}。这用于与
<a4j:keepAlive>
这是我目前的设置。 bean类:
@ViewScoped
public class Bean{
@PreDestroy
public void onDestroy(){ // being destroyed when I don't want to }
}
的面孔,配置:
<navigation-rule>
<from-view-id>/firstPage.xhtml</from-view-id>
<navigation-case>
<from-outcome>redirect</from-outcome>
<to-view-id>/secondPage.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
这个bean应该是@Session的作用域。作为最后一个资源,您可以保存会话中的数据并将其恢复到其他bean的构造函数中。 – 2012-04-11 01:40:23