Reputation: 4607
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
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