Ashish Agarwal
Ashish Agarwal

Reputation: 6283

How to prevent reload of page in Richfaces on action/event?

I am using JSF2.0 and RichFaces 4.0.1 Final. I want to prevent the reload of page on occurence of event.

My use case is: There is a Command button with hidden style. I need to invoke the event attached to it in certain case from Javascript.

Problem: Though I am able to invoke the hidden button, the issue is, the moment it gets invoked, the page is getting reloaded. I want to prevent this reload.

Upvotes: 2

Views: 1618

Answers (1)

BalusC
BalusC

Reputation: 1108632

Just use ajax:

<h:commandButton id="foo" action="#{bean.foo}" styleClass="hide">
    <f:ajax />
</h:commandButton>

Or, since you're already using RichFaces:

<a4j:commandButton id="foo" action="#{bean.foo}" styleClass="hide" />

Upvotes: 3

Related Questions