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 Required Default Description
page String yes The name of a application page to link to.
parameters Object or Object[] or List no An array of objects to be encoded into the URL. These parameters will be passed to IExternalPage.activateExternalPage() method.
disabled boolean 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 no The name of an anchor or element to link to. The final URL will have '#' and the anchor appended to it.
scheme String no The required scheme ("http" or "https", typically) for the URL. This will force the creation of an absolute URL when the current request's scheme does not match the value for this parameter. This is most often used to switch to "https" for secure portions of an application (such as a login page), before switching back to standard "http" for the majority of an application.
port Integer no The required port (80, 443, 8080. 8443, typically) for the URL. This will force the creation of an absolute URL when the current request's scheme does not match the value for this parameter. This is most often used in conjunction with scheme to switch to "https:443"/"https:8443" for secure portions of an application (such as a login page), before switching back to standard "http:80"/"http:80" for the majority of an application.
target String no The target window to use in the link.
renderer ILinkRenderer 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
    
  }
  
}