JSF Showcase

Note

  • h:link is intended to be used to render a hyperlink that navigates to other JSF views via HTTP GET, or perhaps to re-render the same view with different view parameters via f:param child tags.
  • h:outputLink is intended to be used to render a simple <a href="...">hyperlink</a> that requests a URL via HTTP GET.

h:link

HtmlLink is a UIOutcomeTarget component that renders an <a> element (hyperlink).

General Usage

The text/content of the hyperlink can be specified via the value of the component or by specifying child components. Setting includeViewParams=true will automatically include all of the f:viewParam tags (view parameters) as URL parameters.

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: Specifying hyperlink text via the value attribute -->
	<h:form>
		<h:link includeViewParams="true" 
			value="#{i18n['text-for-a-link']}" />
	</h:form>

	<!-- Example 2: Specifying children as hyperlink text/content -->
	<h:form>
		<h:link includeViewParams="true" type="image/png">
			<h:outputText value=" #{i18n['text-for-a-link']} " />
			<h:graphicImage value="#{resource['images:jsf-logo-small.png']}" />
		</h:link>
	</h:form>

</ui:composition>
Liferay Faces Bridge Implementation 4.0.0 + Showcase Common 3.0.0 + Liferay Faces Util 3.0.1-SNAPSHOT + Mojarra 2.2.13