1

我有自定义 Authenticator,我想在 seam 3 中成功验证后重定向到主页。我怎样才能做到这一点 ??

4

2 回答 2

1

有几种方法可以做到这一点。

最简单的方法是return "/home.xhtml";在您的登录操作中。

于 2011-05-11T07:06:48.097 回答
1

另一种方法是在 faces-config.xml 中使用导航规则:

   <navigation-rule>
      <from-view-id>/loginPage.xhtml</from-view-id>
      <navigation-case>
         <from-action>#{authBean.login}</from-action>
         <from-outcome>success</from-outcome> 
         <to-view-id>/homePage.xhtml</to-view-id>
         <redirect/>
      </navigation-case>
      <navigation-case>
         <from-action>#{authBean.login}</from-action>
         <from-outcome>fail</from-outcome> 
         <to-view-id>/loginPage.xhtml</to-view-id>
         <redirect/>
      </navigation-case>
   </navigation-rule>
于 2011-05-11T11:49:06.073 回答