登录前导航到页面不起作用

时间:2013-02-02 09:14:39

标签: jsf-2

我想在将第一页加载到会话之前设置我的数据。

我的XHTML:

<f:event listener="#{beforeLogin.setup}" type="preRenderView"></f:event>

My Managed 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 PostConstruct方法下,我从会话中获得Key1null。任何人都可以建议我在做错的地方吗?注意:我甚至尝试使用SessionScope用于BeforeLogin bean。

0 个答案:

没有答案
相关问题