Home » JSF h:commandLink

JSF h:commandLink

by Online Tutorials Library

JSF <h:commandLink> Tag

JSF renders it as an HTML “a” anchor element that acts like a form submit button when clicked. So, you can create anchor tag by using this tag. An h:commandLink tag must include a nested h:outputText tag, which represents the text that the user clicks to generate the event. It’s also required to be placed inside a <h:form> tag.

JSF <h:commandLink> Tag Example

JSF renders <h:commandLink> tag as below:

Output:

JSF H commandlink tag 1


Note: The h:commandLink tag renders JavaScript scripting language code. If you use it, make sure that your browser is JavaScript enabled.

JSF <h:commandLink> Tag Attributes

Attribute Description
id It is an identifier for this component. This id must be unique. You can use it to access HTML element in CSS and JS file.
value It is used to display label for this component.
type The content type of the resource designated by this hyperlink.
action It is used to provide action for this commandlink.
accesskey Access key that, when pressed, transfers focus to this element. It varies browser to browser.
actionListener It represents an action listener method that will be notified when this component is activated by the user.
charset The character encoding of the resource designated by this hyperlink.
coords It is used to set position and shape of the hot spot on the screen (for use in client-side image maps).
disabled It is used to disabled component. You can disabled it by assigning true value.
hreflang It is used to set the language code of the resource designated by this hyperlink.
rel The relationship from the current document to the anchor specified by this hyperlink. The value of this attribute is a space-separated list of link types.
rendered It is used to render this component. You can set it’s value true or false. Default value is true.
rev It is a reverse link from the anchor specified by this hyperlink to the current document. The value of this attribute is a space-separated list of link types.
shape It represents the shape of the hot spot on the screen. The valid values are: default (entire region); rect (rectangular region); circle (circular region); and poly (polygonal region).
style It is used to set CSS style code to provide better user interface of this component.

You may also like