LinkButton

Table of Contents

Overview

Since 2.0

The ace:linkButton component acts as an Html anchor, a source for Ajax ActionEvents, or a hybrid of both. Occasionally, it's convenient to have an anchor tag that POSTs an event to the server, but which you can also right click and open in a new tab. This functionality is not present in the JSF form of the commandLink.

See the ICEfaces Showcase Live Demo of this component, complete with source code.

Getting Started

<html ... xmlns:ace="http://www.icefaces.org/icefaces/components">

1) Standard HTML Anchor tag behaviour
<ace:linkButton value="Right click to open www.yahoo.com in new tab"
                href="http://www.yahoo.com" />

2) Standard JSF Ajax link behaviour
<ace:linkButton value="Click link to fire action event on actionListener"
                actionListener="#{linkBean.buttonPressHandler}" />

3) Hybrid Ajax and HTML anchor behaviour. Clicking on this link will fire actionListener,
but not navigate to www.yahoo.com, however, right clicking on link allows www.yahoo.com
to be opened in new tab or window.
<ace:linkButton value="Right click to open www.yahoo.com in new tab"
                actionListener="#{linkBean.buttonPressHandler}"
                href="http://www.yahoo.com" />

Attributes

TagLib Documentation
This section covers attributes involved in the typical use-cases for this component. For reference, the complete taglib documentation for this component is available here.

value The text that appears as the link.

style Passes an inline style attribute to the underlying anchor tag.

styleClass CSS classes to be applied to the root <div>.

tabindex Passes the page tabindex value to the underlying anchor, default=0.

disabled Passes a disabled flag to the underlying YUI component. A 'true' value indicates the component is visible but disabled.

href If no action or action listener is defined, the href is a standard anchor href. If an actionListener or action attribute are present the href parameter is available for opening in a new tab or window via right click.

hrefLang The hreflang attribute specifies the language of a linked document. For completeness only, as hreflang is not supported by any of the major browsers.

target Standard anchor target attribute. Available only on anchors with no action or action listener attributes.

The following attributes are supported as pass-thru attributes: accesskey, charset, coords, disabled, hreflang, rel, rev, shape, target,dir, style, tabindex, title, type, onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onblur, onfocus

Event Listeners

As a descendant of UICommand, this component supports an action listener.

actionListener Method that will be notified when the component is activated by the user

Client Behavior Events

action Fired when the button is clicked or pressed by any other means (default event).
Prior to 4.0 this event was named "activate". The "activate" event name is now deprecated but treated as an alias for "action" for backwards compatibility with existing applications.

JavaScript API

ICEfaces 3.x

The client side component object is exposed through the global variable name specified in the widgetVar attribute.

ICEfaces 4+

The "widgetVar" attribute on the ACE components has been removed in ICEfaces 4 and in its place a new "ice.ace.instance()" client JavaScript object lookup API has been introduced. The reason for this change is to enable lazy-initialization of the ACE component JavaScript objects to improve runtime performance and reduce browser memory use.

var widget = ice.ace.instance('frm:componentId);
The ice.ace.instance function requires the full client id of the component to be specified, such as "j_idt77:componentId" instead of just "componentId". To reduce the complexity of working with complete IDs with this function it may be preferable in some cases to use prependId="false" in the enclosing form (e.g. <h:form prependId="false">).
This component doesn't have a client-side API made specifically to be used by application developers. However, the component's internal methods and variables can be accessed in this way, including the underlying jQuery object and objects from underlying Javascript libraries (if applicable), and can be used for whatever purpose a developer might have in mind.

CSS Classes

The following markup represents the basic HTML structure of the component and the CSS classes it uses.

<div class="ice-linkbutton [user defined classes]" style="[user defined styles]">
	<span class="yui-button yui-link-button ui-button ui-widget">
		<span class="first-child">
			<a>Label</a>
		</span>
	</span>
</div>

Keyboard and ARIA Support

The following ARIA roles are supported: button.

Known Issues

None.

Additional Resources

None.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© Copyright 2018 ICEsoft Technologies Canada Corp.