我知道在 faces-config.xml 文件中可以设置导航规则。但在那里,我只知道在正确的流程中进行导航的选项,但我想避免未登录的用户在输入URL时直接进入主屏幕。
但我想避免未登录的用户在adressbar中输入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>
希望你能帮助我
安全性不是导航规则可以处理的。 使用一个过滤器为你处理它(我建议使用 春季安全).