Skip to main content

Configuring the Menu

It is possible to configure the menu of your application by adding some configuration to the menu file. This file can be found in {application}/control/gen/struts2/resources/menu/{application}.menu in the expanded project.

tip

.menu files are XML files. It can be helpful to associate the .menu filetype with XML in your editor when working with these files.

The file already contains a menu:

demoApp.menu
<!-- anchor:default-complete:start -->
<menu profile="default-complete">
<!-- ... -->
</menu>
<!-- anchor:default-complete:end -->

This is the default menu to which the application falls back if no other menus are applicable.

Create a new menu by adding one to the custom-menus anchor. Each menu is linked to a User Profile so that only users with that profile can see that menu.

To create a single menu for all remaining profiles, use profile="default".

demoApp.menu
<!-- anchor:custom-menus:start -->
<menu profile="user">
<!-- ... -->
</menu>
<!-- anchor:custom-menus:end -->

To add a new link, you can define a menuitem. The ref attribute should contain {componentName}-{dataElementName}-list-page.

<menuitem ref="space-starship-list-page"/>

You can also group menuitems in a submenu:

<submenu name="My Ships">
<menuitem ref="space-starship-list-page"/>
<menuitem ref="space-maintenance-list-page"/>
</submenu>

Separator

Add a separator to create subsections:

<submenu name="Star Systems">
<menuitem ref="space-starSystem-list-page"/>
<separator/>
<menuitem ref="space-star-list-page"/>
<menuitem ref="space-planetarySystem-list-page"/>
<menuitem ref="space-planet-list-page"/>
</submenu>