Component Index   Any

ActionLink
net.sf.tapestry.link.ActionLink
Action Link
 
Description
Creates an <a> hyperlink in the HTML response. If the link is triggered, then the ActionLink retrieves its listener, and invokes actionTriggered() on it.

See the Developers Guide ActionLink and DirectLink listeners for a more complete description.

See Also
DirectLink, ExternalLink, GenericLink, PageLink, ServiceLink
Parameters
Name Type Direction Required Default Description
listener IActionListener in yes   Specifies an object that is notified when the link is clicked, which is typically a listener method of its container (for example, listeners.method).
disabled boolean in no false Controls whether the link is produced. If disabled, the portion of the template the link surrounds is still rendered, but not the link itself.
stateful boolean in no true If true (the default), then the component requires an active (i.e., non-new) HttpSession when triggered. Failing that, it throws a StaleLinkException. If false, then no check is necessary. The latter works well with links that encode all necessary state inside the URL itself.
scheme String in no   If specified, then a longer URL (including scheme, server and possibly port) is generated using the specified scheme. Server is determined fromt he incoming request, and port is deterimined from the port paramter or the incoming request.
port int in no   If specified, then a longer URL (including scheme, server and port) is generated using the specified port. The server is determined from the incoming request, the scheme from the scheme paramter or the incoming request.
anchor String in no   The name of an anchor or element to link to. The final URL will have '#' and the anchor appended to it.

Body: rendered
Informal parameters: allowed
Reserved parameters: "href"

Examples

In this example the ActionLink component enables users to select a Customer from the Customer List table.

ID   Name   Level

10276   Ms Sophie L. Jamies   Platinum
10539   Mr Albert H. Davies   Gold
10552   Mrs Jan S. Flawson   Gold
10863   Mr Robert J. Hassel   Silver

<table cellspacing="6">
  <tr>
   <td>ID</td>
   <td>&nbsp;</td>
   <td>Name</td>
   <td>&nbsp;</td>
   <td>Level</td>
  </tr>
  <tr>
   <td colspan="5"><hr></td>
  </tr>
 <span jwcid="foreachCustomer">
  <tr>
   <td><span jwcid="insertId"/></td>
   <td>&nbsp;</td>
   <td><span jwcid="actionLinkCustomer"> <span jwcid="insertFullName"/> </span></td>
   <td>&nbsp;</td>
   <td><span jwcid="insertMemberLevel"/></td>
  </tr>
 </span>
</table>


<component id="foreachCustomer" type="Foreach">
    <binding name="source" expression="customerList"/>
    <binding name="value" expression="customer"/>
</component>

<component id="actionLinkCustomer" type="ActionLink">
    <binding name="listener" expression="listeners.customerSelectAction"/>
</component>

<component id="insertId" type="Insert">
    <binding name="value" expression="customer.id"/>
</component>

<component id="insertFullName" type="Insert">
    <binding name="value" expression="customer.fullName"/>
</component>

<component id="insertMemberLevel" type="Insert">
    <binding name="value" expression="customer.memberLevel"/>
</component>


public class SalesPage extends BasePage {
    private List customerList;
    private Customer customer;
	 
    public List getCustomerList() { return customerList; }
	 
    public List setCustomerList(List value) { 
        customerList = value;
        fireObservedChange("customerList", value); 
    }

    public Customer getCustomer() { return customer; }

    public void setCustomer(Customer value) {
        customer = value;
    }
    
    public void customerSelectAction(IRequestCycle cycle) {
        Customer customer = getCustomer();
        // Perform some action with the selected customer.
    }

    protected void initialize() {
        customerList = null;
        customer = null;
    }
}

public class Customer implements Serializable {
    private Integer id;
    private String fullName;
    private String memberLevel;

    public Customer(Integer id, String fullName, String memberLevel) { 
        this.id = id;
        this.fullName = fullName;
        this.memberLevel = memberLevel; 
    }

    public Integer getId() { return id; }
		
    public String getFullName() { return fullName; }

    public String getMemberLevel() { return memberLevel; }
}

Component Index   Any