JSF Showcase

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

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

	<!-- Example 1: Styling via children -->
	<h:form>
		<h:commandLink >
			<h:outputText value=" #{i18n['text-for-a-link']} " />
			<h:graphicImage value="#{resource['images:jsf-logo-small.png']}" />
		</h:commandLink>
	</h:form>

	<!-- Example 2: Styling via value attribute -->
	<h:form>
		<h:commandLink value="#{i18n['text-for-a-link']}" />
	</h:form>

</ui:composition>
Liferay Faces Bridge Implementation 4.1.0 + Showcase Common 3.0.1 + Liferay Faces Util 3.1.0 + Mojarra 2.2.14