2013-05-14 70 views
-1

我知道 可以在faces-config.xml文件中设置导航规则。但在那里,我只知道选择以正确的流程进行导航。JSF中的导航规则

但我想避免未登录的用户在地址栏中输入网址时直接进入主屏幕。 有没有可能在配置文件中做到这一点,或者我必须写一个Frontcontroller作为一个类?

我的代码:

<navigation-rule> 
    <from-view-id>/login.xhtml</from-view-id> 
    <navigation-case> 
     <from-outcome>register</from-outcome> 
     <to-view-id>/register.xhtml</to-view-id> 
    </navigation-case> 
    <navigation-case> 
     <from-outcome>succes</from-outcome> 
     <to-view-id>/home.xhtml</to-view-id> 
    </navigation-case> 
    <navigation-case> 
     <from-outcome>fail</from-outcome> 
     <to-view-id>/login.xhtml</to-view-id> 
    </navigation-case> 
</navigation-rule> 

希望你能帮助我。

+0

检查:http://stackoverflow.com/questions/10154202/how-do-i-do-security-in-jsf问候 – 2013-05-14 09:57:34

回答

1

安全性不是由导航规则处理的东西。使用过滤器为您处理它(我会建议Spring security)。