The Java EE 6 Tutorial, Volume I

Rendering a Hyperlink With the h:commandLink Tag

The h:commandLink tag represents an HTML hyperlink and is rendered as an HTML <a> element. It acts like a form submit button and is used to submit an action event to the application.

A h:commandLink tag must include a nested h:outputText tag, which represents the text that the user clicks to generate the event. Here is an example:

<h:commandLink id="NAmerica" action="bookstore"
     <h:outputText value="#{bundle.English}" />

This tag will render the following HTML:

<a id="_id3:NAmerica" href="#"
     return false;">English</a>

Note –

The h:commandLink tag will render JavaScript. If you use this tag, make sure your browser is enabled for JavaScript.