Option Component Index PropertySelection

PageLink
org.apache.tapestry.link.PageLink
Page Link
 

Description
Creates a HTML <a> hyperlink to another page within the application. The Page component uses the PageService to construct the anchor's "href" URL.

Prior to release 2.2, this component was named Page.

See Also
ActionLink, DirectLink, ExternalLink, GenericLink, Rollover, ServiceLink
Parameters
Name Type Direction Required Default Description
page String in yes   The name of a application page to link to.
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.
namespace INamespace in no   If specified, the namespace's prefix is prefixed (with a colon) to the page name. This is primarily used when pages (or components) in a namespace need to create links to other pages inside the same namespace (this is only a concern for developers of component libraries, not developers of applications).
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.
renderer ILinkRenderer in no   The object which will actually render the link.

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

This example uses the PageLink component to create a navigation menu bar across the top of the page. If the user is not authenticated, in their Visit object, all the navigation bar links are disabled.

Typically you would create an navigation menu component, using the RenderBody component. This navigation menu component would then be included as the first element in all the application's pages.

Home Inbox Sent Compose Contacts Options Help Logout
My mail page content.
<!-- Navigation Bar -->
<table bgcolor="navy" cellpadding="8" cellspacing="6" width="100%">
 <tr jwcid="@Foreach" source="ognl:engine@NAVIGATION_PAGES" value="ognl:navigationPage" element="tr">
   <td><font color="white"><b><span jwcid="@PageLink" page="ognl:navigationPage" disabled="ognl:! visit.authenticated"/></b></font></td>
 </tr>
</table>


<property-specification name="navigationPage" type="java.lang.String"/>
public abstract class MailPage extends BasePage { public abstract String getNavigationPage(); } public class Visit implements Serializable { private boolean authenticated; public boolean isAuthenticated() { return authenticated; } public void setAuthenticated(boolean value) { authenticated = value; } } public class MailEngine extends SimpleEngine implements Serializable { public static final String[] NAVIGATION_PAGES = { "Home", "Inbox", "Sent", "Compose", "Contacts", "Options", "Help", "Logout" }; }

Option Component Index PropertySelection