The Common-Controls Tag Library

<menu:menu>

A menu definition is triggered with this tag. The actual menu options are specified with <menu:menuitem>-tags in the tag-body.
../images/images/menu.gif

Body content: JSP
Tag class: MenuTag
 

[ Syntax ]

Standard Syntax
<menu:menu
[ action = "String" ]
[ height = "String" ]
[ id = "String" ]
[ imagemap = "String" ]
[ locale = "String" ]
[ menuid = "String" ]
[ name = "String" ]
[ permission = "ACL" ]
[ property = "String" ]
[ style = "String" ]
[ styleClass = "String" ]
[ styleId = "String" ]
[ type = "{main | tools | sidebar}" ]
[ width = "String" ]
>
...Body Content...

</menu:menu>
 

[ Attributes ]

AttributeTypeDescriptionReq.RTExp
actionString Specifies the Struts Action that is to be called upon selection of a menu entry. However, the action can also be specified individually in the individual menu options.  
heightString Sets the height of the control element. The height may be specified in absolute or percent terms.

See the HTML documentation

 
idString The name of a page scope JSP bean that will contain the current element. Using the given Id, the variable can be accessed in scripting expressions in the tag Body. The id mus be a string lteral because the JSP compiler generates a variable withthis name at compile time

Annotation: A valid Java identifier must be given.

 
imagemapString Specifies the name of an Imagemap which must be saved in the request. The value of the imageref property of the menu entries are mapped to the entries in this Imagemap. The mapping is done with the help of the regular expression, which is assigned to every entry of the Imagemap.

The Painter appends to the imageref-value implicit, the following suffixes in order to distinguish between different states:

  • .sel = selected menu entry.
  • .dis = disabled.
  • .unsel = de-selected menu entry.

The selected menu option is always determined through the current menu context which can be set in the JSP-Page with <menu:ctx> or in the application with com.cc.framework.ui.control.MenuContext.setPath().

Annotation: Under the name, there must be an Imagemap saved in the request.

 
localeString enables localization for the control element. String literals will be interpreted as keys in the Application.properties file.

Annotation: boolean value true oder false oder the name of a locale.

 
menuidString Defines the internally used identificator of the menu. A menu path can also be specified here.

A menu or menu option can be considered to be selected when the current menu context path starts with the identificator given here!

Example:
The Id of the menu is admin/tools and the current context path is admin/tools/dbquery .

  • The entire menu is then considered to be selected.
  • A lower-level menu option with the id dbquery would now be depicted as an active menu option since its complete menu path admin/tools/dbquery fits in the context path.
  • The lower-level menu option with the id sessionlist would be depicted as an unselected menu option, since ist complete menu path admin/tools/sessionlist does not fit in the context path.

Annotation: Individual path elements are delimited with "/".

 
nameString Specifies the name of the Java-Bean. The Java-Bean must be stored in the given scope.

When the tag is surrounded by a Struts <html:form> tag, no Bean Name need be specified. In this case, the Java-Bean is drawn via a property of the Struts Form Bean.

Annotation: A valid Java identifier must be given.

 
permissionACL With this attribute, access to the element can be restricted.

Authorizations are checked using the com.cc.framework.security.Principal object in the user session. The principal object is registered in the session with the method com.cc.framework.security.SecurityUtil#registerPrincipal(HttpSession, Principal). It is made available by the application developer by implementing the principal interface. In this manner, any authorization system can be very easily connected within the framework.

Authorizations are always specified in the form of an Access Control List (ACL). What is involved here is a semicolon-delimited list with individual authorizations. The framweork supports the following authorization types, which, however, can be expanded at will by the application developer:

Literal
true|false -> com.cc.framework.security.StaticPermission
Role
#rolename -> com.cc.framework.security.RoleBasedPermission
Function
$functionname -> com.cc.framework.security.FunctionBasedPermission

 
propertyString Specifies the name of the property using which the Java-Bean is to be accessed. This is generally only necessary when the Java-Bean is associated with a Struts Form Bean.

Annotation: A valid Java identifier must be given.

 
styleString An HTML-style can be directly specified with this attribute.

Annotation: See HTML documentation for the attribute style.

 
styleClassString The HTML-class attribute of the element can be specified with this attribute.

Annotation: See HTML documentation for the attribute class.

 
styleIdString The HTML-id attribute of the element can be specified with this attribute.

Annotation: See HTML documentation for the Attribute id.

 
typeMenuType Specifies the menu type and hence the visual appearance of the menu.
  • main = for a horizontal main menu.
  • tools = for a horizontal Tools menu .
  • sidebar = for a vertical menu.
 
widthString Sets the width of the control element. The height may be specified in absolute or percent terms.

See the HTML documentation

 

[ Example ]

Generates a simple horizontal menu.


<%@ taglib uri="http://www.common-controls.com/cc/tags-menu"  prefix="menu" %>
<%@ taglib uri="http://www.common-controls.com/cc/tags-util"  prefix="util" %>

<util:imagemap name="im_menu">
    <util:imagemapping  rule="logout.sel"    src="images/menu/btnLogout5.gif"/>
    <util:imagemapping  rule="logout.unsel"  src="images/menu/btnLogout1.gif"/>
    <util:imagemapping  rule="logout.dis"    src="images/menu/btnLogout4.gif"/>
    <util:imagemapping  rule="about.sel"     src="images/menu/btnAbout5.gif"/>
    <util:imagemapping  rule="about.unsel"   src="images/menu/btnAbout1.gif"/>
</util:imagemap>

<td nowrapbgcolor="#307987">
    <menu:menu id="admin/tools" type="tools" imagemap="im_menu">
        <menu:menuitem  id="main"    text="Main"    imageref="main"    action="main.do"/>
        <menu:menuitem  id="help"    text="Help"    imageref="help"    action="help.do"/>
        <menu:menuitem  id="logout"  text="Logout"  imageref="logout"  action="logoff.do"/>
        <menu:menuitem  id="about"   text="About"   imageref="about"   action="about.do"  tooltip="about Application"/>
    </menu:menu>
</td>