Encapsulate menuItem with taglib, jsp, JS?
-
20-09-2019 - |
Question
How could I encapsulate the authentication logic, the URL and the label of a Menu item when I make use of e.g. a Dojo MenuItem widget?
What I currently have is this:
<auth:isRole role="admin">
<div dojoType="widget.Menu.MenuItem">
<a href="<html:rewrite page="... complicated url ..."/>">
<bean:message key="label.goes.here"/>
</a>
</div>
</auth:isRole>
And what I would like to achieve would be something like:
<util:menuitem role="admin" link="...complicated url..." label="label.goes.here" />
Is this possible to implement with a custom tag? Would there be other options to use Ajax or JS helpers?
Solution
There's a project called Struts Menu that is a combination of a taglib, a config file, and Velocity templates to encapsulate menu display logic and security. I don't think there's an existing Velocity template for Dojo menus, but it shouldn't be difficult to write one.
OTHER TIPS
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow