For many applications using the
control to centralize application navigation is very useful. Menus are
defined in a
WEB-INF/menu.xml file which is very easy to
A menu is typically defined in the a page border template so they are available through out the application. The Menu control does not support HTML rendering, so you need to define a Velocity macro to programmatically render the menu. You would call the macro in your border template with code like this:
An advantage of using a macro to render your menu is that you can reuse
the code across different applications, and to modify an applications menu you
simply need to edit the
WEB-INF/menu.xml file. A good
place to define your macros is in the webroot
file as it is automatically included by Click.
Using macros you can create dynamic menu behaviour such as only rendering menu items a user is authorized to access with isUserInRoles().