73
RichFaces <a4j:commandButton>
The <a4j:commandButton> component is similar to the JavaServer Faces ( JSF) <h:commandButton> component, but additionally includes Ajax support.
It requires only one value attribute to be used. We can use it to set text for the command button.
By default, the <a4j:commandButton> uses the click event instead of the submit event.
Note – The <a4j:commandButton> component has the execute=”@form” setting by default. To limit rendering to a different scope, redefine the execute attribute.
Example
Here, in the following example, we are implementing <a4j:commandButton> component. This example contains the following files.
JSF File
// commandButton.xhtml
Managed Bean
// User.java
Output:
Next TopicRichFaces <a4j:commandlink>