フラッシュ スコープを使用して、@viewscoped コントローラー間で設定オブジェクトを渡します。しかし、そのうちの 1 つでページをリロードすると、フラッシュ マップが空になり、設定オブジェクトが初期化されません。ページのリロード時にフラッシュ スコープを保持することは可能ですか?
設定を保存/取得するための私のソースコード:
FistPage.xhtml
...
<p:commandButton value="next"
action="#{firstPageController.transferConfig}"
process="@this" />
...
FirstPageController.java
@ManagedBean(name = "firstPageController")
@ViewScoped
public class FirstPageController {
...
public String transferConfig() {
FacesContext.getCurrentInstance().getExternalContext().getFlash().put("searchConfig", searchConfig);
return "/secondPage.xhtml?faces-redirect=true";
}
...
}
SecondPage.xhtml
...
<h:outputLabel value="value">
<f:event type="preRenderComponent" listener="#{secondPageController.onPageLoad()}"/>
</h:outputLabel>
...
SecondPageController.java
@ManagedBean(name = "secondPageController")
@ViewScoped
public class SecondPageController {
...
public void onPageLoad()
{
flash = FacesContext.getCurrentInstance().getExternalContext().getFlash();
searchConfig = ((SearchFilterConfig) flash.get("searchConfig"));
flash.putNow("searchConfig", searchConfig);
flash.keep("searchConfig");
}
...
}
Mojarra 2.1.29を使用しています
ありがとう