ExternalLink
Creates a <a> hyperlink to an IExternalPage which may be bookmarked using the hyperlink's URL.
See also: org.apache.tapestry.link.ExternalLink, DirectLink, GenericLink, PageLink, ServiceLink
Parameters
Name | Type | Direction | Required | Default | Description |
---|---|---|---|---|---|
page | String | in | yes | The name of a application page to link to. | |
parameters | Object or Object[] or List | in | no | An array of objects to be encoded into the URL. These parameters will be passed to IExternalPage.activateExternalPage() 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. |
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. | |
target | String | in | no | The target window to use in the link. | |
renderer | ILinkRenderer | in | no | The object which will actually render the link. |
Body: allowed
Informal parameters: allowed
Reserved parameters: href
Examples
This example illustrates a page displaying some content based on an id and a language code. It contains a link to view the same content in German.
<a href="#" jwcid="@ExternalLink" page="ViewArticle" parameters="ognl:{articleId, 'de'}" disabled="ognl:languageCode=='de'" >view this article in German</a> <div jwcid="@Insert" value="ognl:content">content of the article</div>
package com.myexample; import org.apache.tapestry.IExternalPage; import org.apache.tapestry.IRequestCycle; import org.apache.tapestry.html.BasePage; public abstract class ViewArticle extends BasePage implements IExternalPage { public abstract Integer getArticleId(); public abstract void setArticleId(Integer articleId); public abstract String getLanguageCode(); public abstract void setLanguageCode(String language); public void activateExternalPage(Object[] params, IRequestCycle cycle) { setArticleId((Integer) params[0]); setLanguageCode((String) params[1]); } public String getContent() { // retrieve the content of the article for the selected language } }