Adnan
Adnan

Reputation: 4607

Navigation to same page in JSF1.2

I am having a h:commandButton button named cancel on a JSF1.2 page, when a user press this button he should be redirected to the same page. How it can be achieved in JSF1.2?

Upvotes: 0

Views: 857

Answers (1)

Victor Martinez
Victor Martinez

Reputation: 1112

First remember to set immediate="true" attribute, by default, the tag will invoke all the validators etc.., before invoking the application.

Your button:

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

Your 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>

Upvotes: 3

Related Questions