Component identification parameters

Name | Value
--- | ---
component-type | org.ajax4jsf.CommandLink
component-family | javax.faces.Command
component-class | org.ajax4jsf.component.html.HtmlAjaxCommandLink
renderer-type | org.ajax4jsf.components.AjaxCommandLinkRenderer

## Creating on a page

<a4j:commandLink> is used in the same way as <h:commandLink>, but with definition of the area that is updated after the response comes back from the server.

    <a4j:commandLink reRender="someData" action="#{bean.action1}" value="Link"/>

This definition of the component provides a link, and a click on the link causes an Ajax form submit on the server, "action1" method performance, and rendering of the component with "someData" id after the response comes back from the server.

## Dynamical creation of a component from Java code

Example:

    import org.ajax4jsf.component.html.HtmlAjaxCommandLink;
    ...
    HtmlAjaxCommandLink myLink = new HtmlAjaxCommandLink();
    ...

## Key attributes and ways of usage

The component <a4j:commandLink> placed on a page generates the following HTML code:

    <a href="#" onclick="A4J.AJAX.Submit(?"request parameters");
    	  return
    	  <a href="#" onclick="A4J.AJAX.Submit(?"request parameters");
    	  return false;">
    	  <span style="color: black;">Link Value</span>
    	  </a>

Hence, the utility method "A4J.AJAX.Submit" is called on a click, the method performs Ajax request as the <a4j:support> component

Note:

AJAX support is built in and it's not necessary to add nested <a4j:support> to the component.

Common JSF navigation could be performed after Ajax submit and partial rendering, but Navigation Case must be defined as <redirect/> in order to avoid problems with some browsers.

As any Core Ajax component sending Ajax requests and processing server responses <a4j:commandLink> has all attributes described above (see <a4j:support> chapter) that provide the required behavior of requests sending (delay, limitation of submit area and rendering, etc.)

## Relevant resources links

Here you can see the example of <a4j:commandLink> usage and sources for the given example