Home » JSF h:commandButton

JSF h:commandButton

by Online Tutorials Library

JSF <h:commandButton> Tag

It creates a submit button and used to submit a application form. You can create it by using the following syntax.

JSF <h:commandButton> Tag Example:

In the following example, we have created a form which is submitted by using a <h:commandButton>.

JSF renders <h:commandButton> tag as below:


JSF H commandbutton tag 1

JSF <h:commandButton> Tag Attributes:

Attribute Description
id It is an identifier for this component. This id must be unique. You can use it to access HTML element in CSS and JS file.
value It holds current value for the commandbutton and display it as name of submit button.
action It is used to specify action for the form. The commandButton submits the form to the server at the specified action. If you don’t provide action, page redirect to the same page after submitting.
disabled It is used to make a commandButton disabled. You can’t click on the button after applying this attribute.
image It is used to set an image on the commandButton. In this case, your image will work as submit button.
label It is used to make localized name for your comandButton.
rendered It is used to render the component. The default value for this property is true.
type It is used to specify type of button. You can set “reset”, “submit” or “button”. If don’t specify, it is submit by default.
style It is used to specify CSS for the component.
onclick It is used to execute JavaScript code when commandButton is clicked.
accesskey It is used to access submit-button by using specified key.

You may also like