Yes, you can simply construct the MenuComponent objects yourself, and
put them into the MenuRepository.  How you want to scope this is up to
you.  The MenuPlugin defaults to loading a MenuRepository using an xml
file and sets it as an application scope attribute.  

If you want to maintain a set of globally common menus (i.e. you don't
need user specific menus) then you can simply create your own PlugIn to
initialize the repository with your menus from your database.

If you want user specific menus, you'll want to do the same thing as
above, but probably at some kind of session initialization or login
event and set the MenuRepository as a session scoped attribute.

The main thing to note is that the DisplayMenuTag is told what attribute
key to use to lookup a MenuRepository.  It uses a default key
(MenuRepository.MENU_REPOSITORY_KEY or something like that).  You can
either use your own, or specify a different one.  The DisplayMenuTag
will do a pageContext.findAttribute("attributeKey") so it will find it
in any scope.

Scott

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
atta-ur rehman
Sent: Tuesday, August 19, 2003 6:50 PM
To: [EMAIL PROTECTED]
Subject: [struts-menu] On-the-fly menu contents


Hi, 

Is it possible to get menu hierarchy from the database insteand of an
xml file? I need to show a tree-like structure on my page and i think,
the way struts-menu works in the examples, i can use struts-menu for
this.

any other ideas on handling tree-like structures in a struts app?

thanks for any help.

ATTA



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
struts-menu-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/struts-menu-user

Reply via email to