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.
<!-- Navigation Bar -->
<table bgcolor="navy" cellpadding="8" cellspacing="6" width="100%">
<tr>
<span jwcid="foreachNavigationPage">
<td><font color="white"><b><span jwcid="navigationPageLink"/></b></font></td>
</span>
</tr>
</table>
<component id="foreachNavigationPage" type="Foreach">
<binding name="source" expression="engine@NAVIGATION_PAGES"/>
<binding name="value" expression="navigationPage"/>
</component>
<component id="navigationPageLink" type="PageLink">
<binding name="page" expression="navigationPage"/>
<binding name="disabled" expression="! visit.authenticated"/>
</component>
public class MailPage extends BasePage {
private String navigationPage;
public String getNavigationPage() { return navigationPage; }
public void setNavigationPage(String value) {
navigationPage = value;
}
public void detach() {
navigationPage = null;
super.detach();
}
}
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" };
}
|