基本上相同的問題作爲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