开发者

Redirect to home page after login seam 3

I have custom Authenticator and I want to redirect to home page after successfully authenticate in seam开发者_StackOverflow社区 3 . How can i do that ??


There are a few ways to do this.

The simplest way is to return "/home.xhtml"; in your login action.


Other way is use navigation rule in 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜