-1

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

但是我想避免未登录的用户在地址栏中键入 URL 时可以直接进入主屏幕。是否可以在配置文件中执行此操作,还是必须将 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>

希望您能够帮助我。

4

1 回答 1

2

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

于 2013-05-14T09:37:50.507 回答