0

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

4

1 回答 1

3

首先记得设置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>
于 2011-10-24T09:02:07.620 回答