In my previous post, Dynamically Load Menus with SiteMesh, I described how to load menus dynamically based on the variable in the pages. Here, to highlight last selected menu (which means current menu item) we can use same thing.
This time the variables we specify in every page will be name for the menu items.
And instead of include jsp page in the previous post, we need to set menu items like this :
<li>
<a class="${currentMenu == 'abc_menu' ? 'selected':''}"
title="Abc" href="abc.html">Abc</a>
</li>
Here, for every menu item, it is needed to specify class decision. And do not forget to add css style for selected.
No comments:
Post a Comment