在JSF1.2中导航到同一页面

时间:2011-10-24 08:17:52

标签: jsf jsf-1.2

我在JSF1.2页面上有一个名为cancel的h:commandButton按钮,当用户按下此按钮时,他应该被重定向到同一页面。如何在JSF1.2中实现?

1 个答案:

答案 0 :(得分:2)

首先记得设置immediate="true"属性,默认情况下,标签会在调用应用程序之前调用所有验证器等。

您的按钮:

<h:commandButton value="cancel" action="cancel"  title="Cancel this page" />

你的faces-context.xml:

<navigation-rule>
    <from-view-id>index.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>cancel</from-outcome>
        <to-view-id>index.xhtml</to-view-id>
        <redirect/>
    </navigation-case>
</navigation-rule>