开发者

JSF Navigation Rule to the page itself

开发者 https://www.devze.com 2023-02-13 18:19 出处:网络
How can I define开发者_StackOverflow社区 a navigation rule from all view-ids from #{current.doLogout} to the same view-id?You need to use wildcards to achieve this

How can I define开发者_StackOverflow社区 a navigation rule from all view-ids from #{current.doLogout} to the same view-id?


You need to use wildcards to achieve this

Just call the logout method in action tag. and just add this to your faces-config.xml

<navigation-rule>
 <from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>welcome</from-outcome>
<to-view-id>/login.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>


If you don't define any or return null or void in action method, it will by default display the same page as where the form is been submitted.

public void doLogout() {
    // Logout.
}

This way you don't need to fiddle with navigation cases in faces-config.xml. Are you by the way already aware of the new JSF 2.0 "implicit navigation" feature?

0

精彩评论

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