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).

Param Usage

URL parameters can be specified via f:param child tags. 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:f="http://xmlns.jcp.org/jsf/core" xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

	<!-- Implicit navigation back to /views/component.xhtml -->
	<!-- Override the value of the componentUseCase view parameter in order to navigate to a -->
	<!-- different view. -->
	<h:link includeViewParams="true" outcome="component">
		<f:param name="componentUseCase" value="navigation" />
		<f:param name="foo" value="1234" />
		<h:outputText value="&lt; #{i18n['back-to-navigation-with']} foo=1234" />
	</h:link>

</ui:composition>
Liferay Faces Bridge Implementation 5.0.0 + Showcase Common 3.1.1 + Liferay Faces Util 3.4.1 + Mojarra 2.2.20