Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

[Struts Menu] Building Dynamic Menus from a database table

I spent a few hours this weekend and did some work on Struts Menu. At the very least, I made it easier to build dynamic menus programmatically and put together an example of doing it from a database table. I also added support for Expression Language (EL) syntax in all the tag's attributes. For the EL implementation, I simply copied what was implemented in the DisplayTag. I don't know that it's the best way (two TLDs, subclassing tag classes), but it works and it is good enough for now. The main reason I copied the implementation in the DisplayTag is that we've been talking about adding support for OGNL. I figure if I copy the implementation, it should be easy enough to copy the refactorying if/when it happens.

Back to the point of this post - how do you build dynamic menus? So without further ado, here's how to build and display database-driven menus with Struts Menu.

Posted in Java at Mar 14 2004, 04:53:33 PM MST 4 Comments
Comments:

Hey Matt, thank you very much. I always get here to find answers to my questions. You're not a guru (and don't pretend to be), but a down to earth guy, who likes to share his knowdledge with the rest of us.

Posted by Ale from Argentina on March 15, 2004 at 09:53 AM MST #

Thanks for the info Matt. I always enjoy gleaning your 'nuggets of knowledge'. As for your comment in your scriplet code pertaining to retrieving the static menus defined in the default MenuRepository, I use the following with Struts Menu 2.0 in a utility class with no problems: MenuRepository myMenuRepository = (MenuRepository)session.getServletContext().getAttribute( MenuRepository.MENU_REPOSITORY_KEY );

Posted by Paul on March 15, 2004 at 10:30 AM MST #

Hi Matt, I'm doing doing my dynamic menus in a way quite close to yours : - I'm using CoolMenus too - I'm using a Tiles JSP fragment, instead of a taglib - I'm using EJBs (CMP 2.O) to generate the menus. It's really fast, even with more than 100 items (it needs a little bit of tuning of course to achieve this). - I'm caching the Menu in the user's Session, for better performance (I might use OSCache in the future) - I'm managing the permissions by using the user's JAAS roles, like you do. However, I don't need any mapping, because my Menu EJB is linked to the Role EJB. So I have less configuration than you have with StrutsMenu.

Posted by Julien Dubois on March 15, 2004 at 02:29 PM MST #

where is CODE?

Posted by 207.45.248.20 on October 30, 2007 at 04:59 AM MDT #

Post a Comment:
  • HTML Syntax: Allowed