Name

<h:commandLink>

Synopsis

This action represents an instance of the component type registered with the type ID javax.faces.html.HtmlCommandLink (by default, an instance of the javax.faces.component.html.HtmlCommandLink class), combined with a renderer registered with the renderer type ID javax.faces.Link.

The component is rendered as an HTML <a> element, an href attribute containing “#”, and an onclick attribute containing JavaScript code for submitting the form the component belongs to with the component’s client ID as a request parameter. If the component has UIParameter component children, the generated JavaScript code also ensures that each parameter is included as request parameters when the form is submitted, with both the name and value URL encoded. The component’s children that are not UIParameter components are rendered as the content of the <a> element, i.e., as the link text or image. Clicking the rendered link submits the form it belongs to and triggers a javax.faces.event.ActionEvent.

Syntax

<h:commandLink [id="id"] [binding="componentBinding"] [rendered="true|false"] 
  [value="value"]
  [action="actionMethodBinding"] [actionListener="actionListenerBinding"]
  [immediate="true|false"]
  <!-- HTML attributes -->
  [accesskey="accessKey"] [charset="charset"] [coords="coords"] [dir="ltr|rtl"]
  [hreflang="lang"] [lang="lang"]
  [onblur="code"] [ondblclick="code"] [onfocus="code"] 
  [onkeydown="code"] [onkeypress="code"] [onkeyup="code"]
  [onmousedown="code"] [onmousemove="code"] [onmouseout=" ...

Get JavaServer Faces now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.