最初のページをセッションにロードする前にデータをセットアップしたいと考えています。
私のXHTML:
<f:event listener="#{beforeLogin.setup}" type="preRenderView"></f:event>
私のマネージドBean:
@ManagedBean(name="beforeLogin")
@RequestScoped
public class BeforeLogin {
public void setup()
{
.....
FacesContext context = FacesContext.getCurrentInstance();
context.getExternalContext().getSessionMap().put("Key1", "Value1");
....
ConfigurableNavigationHandler nav = (ConfigurableNavigationHandler) context
.getApplication().getNavigationHandler();
nav.performNavigation("LoginPage");
}
}
}
今、メソッドLoginPage
の下で、セッションから値を取得しています。私が間違いを犯している場所を誰かが提案できますか? 注: Beanでも試してみました。PostConstruct
Key1
null
SessionScope
BeforeLogin