Create new RichFaces Documentation Jira issue

This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.orgCommunity Documentation

6.5.3.  < a4j:htmlCommandLink > available since 3.0.0

The <a4j:htmlCommandLink> component is very similar to the same component from the JSF HTML library, the only slight difference is in links generation and problem solving that occurs when an original component is used.

Table 6.52. a4j : htmlCommandLink attributes

Attribute Name Description
accesskeyHTML: This attribute assigns an access key to an element. An access key is a single character from the document character set. Note: Authors should consider the input method of the expected reader when specifying an accesskey
actionMethodBinding pointing at the application action to be invoked, if this UIComponent is activated by you, during the Apply Request Values or Invoke Application phase of the request processing lifecycle, depending on the value of the immediate property
actionListenerMethodBinding pointing at method accepting an ActionEvent with return type void
binding JSF: The attribute takes a value-binding expression for a component property of a backing bean
charsetHTML: The character encoding of a resource designated by this hyperlink
coordsHTML: The attribute specifies shape and it position on the screen. Possible values: "rect: left-x, top-y, right-x, bottom-y", "circle: center-x, center-y, radius", "poly: x1, y1, x2, y2, ..., xN, yN". Notes: a) when giving the radius value in percents, user agents should calculate the final radius value in pixels based on the associated object's width and height; b) the radius value should be smaller than center-x and center-y values; c) for a polygon, the first and last coordinate pairs should have same x and y to close the shape (x1=xN; y1=yN) (when these coordinates are different, user agents should infer an additional pair to close a polygon). Coordinates are relative to the top left corner of an object. All values are lengths. All values are comma separated.
dirHTML: Direction indication for text that does not inherit directionality. Valid values are "LTR" (left-to-right) and "RTL" (right-to-left)
disabledHTML: When set for a form control, this boolean attribute disables the control for your input.
hreflangHTML: Base language of a resource specified with the href attribute; hreflang may only be used with href
id JSF: Every component may have a unique id that is automatically created if omitted
immediateTrue means, that the default ActionListener should be executed immediately (i.e. during Apply Request Values phase of the request processing lifecycle), rather than waiting until the Invoke Application phase
langHTML: Code describing the language used in the generated markup for this component
onblur DHTML: The client-side script method to be called when the element loses the focus either when pointing a device or tabbing navigation. The attribute may be used with the same elements as onfocus
onclick DHTML: The client-side script method to be called when the element is clicked
ondblclick DHTML: The client-side script method to be called when the element is double-clicked
onfocus DHTML: The client-side script method to be called when the element gets the focus
onkeydown DHTML: The client-side script method to be called when a key is pressed down over the element
onkeypress DHTML: The client-side script method to be called when a key is pressed over the element and released
onkeyup DHTML: The client-side script method to be called when a key is released
onmousedown DHTML: The client-side script method to be called when a mouse button is pressed down over the element
onmousemove DHTML: The client-side script method to be called when a pointer is moved within the element
onmouseout DHTML: The client-side script method to be called when a pointer is moved away from the element
onmouseover DHTML: The client-side script method to be called when a pointer is moved onto the element
onmouseup DHTML: The client-side script method to be called when a mouse button is released
relHTML: 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 JSF: If "false", this component is not rendered
revHTML: 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
shapeHTML: This attribute specifies the shape of a region. The possible values are "default", "rect", "circle" and "poly".
styleHTML: CSS style rules to be applied to the component
styleClass JSF: Assigns one or more CSS class names to the component. Corresponds to the HTML "class" attribute.
tabindexHTML: This attribute specifies the position of the current element in the tabbing order for the current document. This value must be a number between 0 and 32767. User agents should ignore leading zeros
targetHTML: This attribute specifies the name of a frame where a document is to be opened. By assigning a name to a frame via the name attribute, authors can refer to it as the "target" of links defined by other elements
titleHTML: Advisory title information about markup elements generated for this component
typeHTML: The content type of the resource designated by this hyperlink
value JSF: The current value for this component

Table 6.53. Component identification parameters

NameValue
component-typejavax.faces.HtmlCommandLink
component-familyjavax.faces.Command
component-classjavax.faces.component.html.HtmlCommandLink
renderer-typeorg.ajax4jsf.HtmlCommandLinkRenderer

Component definition on a page is the same as for the original component from the JSF HTML library.

Example:


<a4j:htmlCommandLink value="value" action="action"/>

Example:

import javax.faces.component.html.HtmlCommandLink;

...
HtmlCommandLink myCommandLink = new HtmlCommandLink();
...

The difference with the original component is that all hidden fields required for command links with the child <f:param> elements are always rendered and it doesn't depend on links rendering on the initial page. It solves the problem with invalid links that weren't rendered on a page immediately, but after some Ajax request.

Example:


<a4j:form>
    ...
    <a4j:htmlComandLink action="action" value="link" rendered="#{bean.rendered}">
        <f:param .../>
    <a4j:htmlComandLink>
    ...
</a4j:form>

In this example <a4j:htmlCommandLink> works as standard <h:commandLink> , but here hidden fields required for correct functionality are rendered before the first downloading of a page, though it doesn't happen if its attribute isn't set to "false".

On RichFaces LiveDemo page you can found some additional information for <a4j:htmlCommandLink> component usage.

On RichFaces LiveDemo page you can found some additional information about <f:param> component.