h:commandLink

HtmlCommandLink is a UICommand component that renders an <a> element. 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 visual purposes. Alternatively, the value attribute can be specified.

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 children -->
  5. <h:form>
  6. <h:commandLink >
  7. <h:outputText value=" #{i18n['text-for-a-link']} " />
  8. <h:graphicImage value="#{resource['images:jsf-logo-small.png']}" />
  9. </h:commandLink>
  10. </h:form>
  11.  
  12. <!-- Example 2: Styling via value attribute -->
  13. <h:form>
  14. <h:commandLink value="#{i18n['text-for-a-link']}" />
  15. </h:form>
  16.  
  17. </ui:composition>
Liferay Faces Bridge Implementation 5.0.0 + Showcase Common 3.1.1 + Liferay Faces Util 3.4.1 + Mojarra 2.2.20