Generates the markup for the pop-up menu. This tag is designed to work with WML clients that might require a customized pop-up menu for some screens.
The contents of the menu are defined by other tags. The actual markup for the menu is produced by this tag. The basic method of producing the pop-up menu is as follows:
- Define the menu template (using the <portal-wml:popupMenuTemplate> tag)
- Define each item in the menu (using the <portal-wml:popupMenuItem> and <portal-wml:popupMenuParam> tags)
- Generate the markup (using the <portal-wml:popupMenu> tag)
By default, this tag produces markup for all menu items that have been defined. The optional parameter maxItem can be used to limit the markup to only the first number of items.
As an example, the following tags could be placed in the <template/>
section of a WML deck (in the /themes/wml/Default.jsp file):
<template>
<%-- basic template for the popup menu --%>
<portal-wml:popupMenuTemplate>
<do type="options" label="{0}">
{1}
</do>
</portal-wml:popupMenuTemplate>
<%-- 1. Back --%>
<portal-wml:popupMenuItem item="1">
<portal-wml:popupMenuParam param="0">
<portal:text key="link.back.wml" bundle="nls.engine"/>
</portal-wml:popupMenuParam>
<portal-wml:popupMenuParam param="1">
<prev/>
</portal-wml:popupMenuParam>
</portal-wml:popupMenuItem>
<%-- 2. Home --%>
<portal-wml:popupMenuItem item="2">
<portal-wml:popupMenuParam param="0">
<portal:text key="link.home.wml" bundle="nls.engine"/>
</portal-wml:popupMenuParam>
<portal-wml:popupMenuParam param="1">
<go href="<portal:url home="public" />"/>
</portal-wml:popupMenuParam>
</portal-wml:popupMenuItem>
<%-- 3. LogIn --%>
<portal-wml:popupMenuItem item="3">
<portal-wml:popupMenuParam param="0">
<portal:text key="link.login.wml" bundle="nls.engine"/>
</portal-wml:popupMenuParam>
<portal-wml:popupMenuParam param="1">
<go href="<portal:url screen="Login" />"/>
</portal-wml:popupMenuParam>
</portal-wml:popupMenuItem>
<portal:if notScreen="Login" >
<portal-wml:popupMenu />
</portal:if>
</template>
- The <portal-wml:popupMenuTemplate/> defines each item as a WML <do type="options" /> statement that has a variable label and body.
- The first item in the menu is defined to have a label of "Back" (link.back.wml in the nls/engine.properties bundle) and the body is mapped to the <prev/> command.
- The second item is defined to have a label of "Home" and is mapped to the home page by the <portal:url> tag.
- The third item is defined to have a label of "Login" and is mapped to the login page.
- The last <portal:if> tag generates the markup for the pop-up menu for all screen other than the login screen.
Because this is all defined in the WML template, all cards in the WML deck will use this menu definition. On an Openwave browser, the menu items are generated with numbers that can be pressed to invoke the option.
This menu would be rendered
1 Back 2 Home 3 Login
On other browsers (such as Nokia), the menu items are displayed without numbers. So on some phones the menu would be rendered
Back Home Login
and the user would have to scroll down to select each item.
However, on the Login screen, the third item should be mapped to the LoginUser command, rather than the Login screen, following these steps:
- Not generating the pop-up menu markup in the <template/> section (using <portal:if notScreen="Login"/>)
- Redefining the third menu item in the <card/> section
- Generating the markup in the <card/> section
In the file, /screens/wml/Login.jsp:
<card id="Login" >
<portal-wml:popupMenuItem item="3">
<portal-wml:popupMenuParam param="1">
<go href="<portal:url command="LoginUser"/>" method="post">
<postfield name="userid" value="$userid"/>
<postfield name="password" value="$password"/>
</go>
</portal-wml:popupMenuParam>
</portal-wml:popupMenuItem>
<portal-wml:popupMenu />
...
<card />