开发者

Redirect to home page after login seam 3

开发者 https://www.devze.com 2023-03-04 17:56 出处:网络
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.

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

精彩评论

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

关注公众号