This is a fairly common question so I'm posting to the user list. We
probably should add this to some kind of FAQ...
The core object that is used to maintain menus and displayer definitions
is the MenuRepository. The related tags utilize the repository to get
this information. By default, the MenuPlugIn is setup to initialize a
MenuRepository and set it as an application scoped attribute. Also, the
MenuRepository is loaded with the menu inforomation from an xml file.
You can bypass this mechanism by simply creating and initializing a
MenuRepository as a session scoped attribute. You don't have to use an
xml config file. You can simply create and add the menus and display
definitiions directly to the repository. You just need to make the
repository available to the <menu:useMenuDisplayer> tag. By default, it
does a pageContext.findAttribute(MenuRepository.MENU_REPOSITORY_KEY).
In general, here is a quick guideline:
1. don't use with the MenuPlugIn
2. create some kind of user session initialization code where you will
create the menus (MenuComponent) programmatically and/or by loadding
from an xml file, for example:
MenuRepository repository = new MenuRepository();
repository.setLoadParam(xmlConfigFileName);
repository.load();
/* and/or load data programmatically */
session.setAttribute(MenuRepository.MENU_REPOSITORY_KEY,
repository);
If you wanted to, you could maintain the default global menu repository
and then create a user session specific one as well. You just need to
tell the UseMenuDisplayerTag which repository to use. You can do this
by specifying the attribute key in the repository attribute:
<menu:useMenuDisplayer ... repository="userSessionRepositoryKey">
Just to make this clear, you can modify all the menu attributes on the
fly.
Scott
> -----Original Message-----
> From: Andriy Ruzhevych [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 30, 2003 7:50 AM
> To: [EMAIL PROTECTED]
> Subject: Struts Menu 1.3
>
>
> Hi Scott.
> I get your struts menu release 1.3 and have questions about
> dynamic generation of menus or opportunity to dynamic
> generation menus in session scope (on each session - other
> menus). Thank you for answer.
>
>
> --- З найкращими побажаннями ---
> Андрій Ружевич
> ICQ 176085985
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
struts-menu-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/struts-menu-user