h:commandButton

HtmlCommandButton is a UICommand component that renders a styleable HTML <input> element. The default type is submit. The component must be a child of h:form in order to trigger the action or actionListener.

General Usage

Children such as h:icon, h:outputText, and h:graphicImage can be specified for styling purposes. Alternatively, the image and value attributes can be specified for styling purposes.

Source Code

  1. <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html"
  2. xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
  3.  
  4. <!-- Example 1: Styling via image attribute -->
  5. <h:form>
  6. <h:commandButton image="#{resource['images:jsf-logo-small.png']}"
  7. value="1234" />
  8. </h:form>
  9.  
  10. <!-- Example#2: Styling via value attribute -->
  11. <h:form>
  12. <h:commandButton value="1234" />
  13. </h:form>
  14.  
  15. </ui:composition>
Liferay Faces Bridge Implementation 5.0.0 + Showcase Common 3.1.1 + Liferay Faces Util 3.4.1 + Mojarra 2.2.20