Thanks Matt. But I have created MENU_REPOSITORY as follows:
Please be patient, it is a little long email with the code snippets.

      //Call SP, get roles and prepare list of roles.
      ArrayList userMenus = new ArrayList();
      userMenus.add("TabbedUserSearch");
      userMenus.add("TabbedAdvSearch");
      userMenus.add("TabbedLogoff");
      userMenus.add("TabbedHelp");
      session.setAttribute(WebConstants.USER_MENUS, userMenus);
      //End of preparing roles.

      //Create Menu Repository, stuff it and keep it in session scope.
      MenuRepository newMenuRep = new MenuRepository();
      MenuRepository mrp = (MenuRepository)
servlet.getServletContext().getAttribute(MenuRepository.MENU_REPOSITORY_KEY)
;
      logDebug.debug("UserInitializationAction: Menu - LoadParam: "  +
mrp.getLoadParam() );
      logDebug.debug("UserInitializationAction: Menu - Name: "  +
mrp.getName() );
      newMenuRep.addMenuDisplayerMapping(
mrp.getMenuDisplayerMapping("DropDown") );
      newMenuRep.addMenuDisplayerMapping(
mrp.getMenuDisplayerMapping("Simple") );
      newMenuRep.addMenuDisplayerMapping(
mrp.getMenuDisplayerMapping("CoolMenu") );
      newMenuRep.addMenuDisplayerMapping(
mrp.getMenuDisplayerMapping("CoolMenu4") );
      newMenuRep.addMenuDisplayerMapping(
mrp.getMenuDisplayerMapping("MenuForm") );
      newMenuRep.addMenuDisplayerMapping(
mrp.getMenuDisplayerMapping("ListMenu") );
      newMenuRep.addMenuDisplayerMapping(
mrp.getMenuDisplayerMapping("TabbedMenu") );
      newMenuRep.addMenuDisplayerMapping(
mrp.getMenuDisplayerMapping("Velocity") );
      Set menuNames = mrp.getMenuNames();
      for( int k = 0; k < userMenus.size(); k++ ) {
        String roleName = (String) userMenus.get(k);
        Iterator iter = menuNames.iterator();
        while( iter.hasNext() ) {
          String menuName = (String) iter.next();
          if( roleName.equalsIgnoreCase(menuName) ) {
                newMenuRep.addMenu( mrp.getMenu(menuName) );
            logDebug.debug("UserInitializationAction: MenuNames: "  +
menuName );
          }
        }
      }
      session.setAttribute(MenuRepository.MENU_REPOSITORY_KEY, newMenuRep);
      //End of Menu Repository creation.

 
I did not find a way to get displayers from existing (default)
Menu_Repository at application scope.
That's why I had to hard code all displayers names and add them to new
Menu_Repository like:
newMenuRep.addMenuDisplayerMapping(
mrp.getMenuDisplayerMapping("TabbedMenu") );

But, even though I created Menu_Repository like this, I had to check for
user Menus in my JSP like:

<bean:define id="userMenus" name="<%=WebConstants.USER_MENUS%>"
type="java.util.ArrayList"/>

  <HR>
  <menu:useMenuDisplayer name="TabbedMenu"
     bundle="org.apache.struts.action.MESSAGE">
  <% for( int i = 0; i < userMenus.size(); i++ ) {
       String menu = (String) userMenus.get(i);
  %>
       <menu:displayMenu name="<%=menu%>"/>

  <% }
  %>
  </menu:useMenuDisplayer>
 
Am I missing anything?  I thought that if I create Menu_Repository and keep
it at session scope,
<menu:useMenuDisplayer> tag will check against this Menu_Repository for all
<menu:displayMenu> tags
and display only menus that are present in Menu_Repository at session scope.

Regards,
Reddy Pingili  



> -----Original Message-----
> From: Matt Raible [SMTP:[EMAIL PROTECTED]
> Sent: Sunday, December 28, 2003 12:22 AM
> To:   [EMAIL PROTECTED]
> Subject:      RE: [struts-menu] Create tabbed menus dynamically based on
> user access level
> 
> I've never done it, but someone did send in the attached code that might
> help you.
> 
> Matt
> 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On Behalf Of 
> > Pingili, Madhupal
> > Sent: Monday, December 22, 2003 9:57 AM
> > To: '[EMAIL PROTECTED]'
> > Subject: RE: [struts-menu] Create tabbed menus dynamically 
> > based on user access level
> > 
> > 
> > Hi,
> > I want to create my own Menu Repository and keep it at 
> > session scope with the key "net.sf.navigator.menu.MENU_REPOSITORY" 
> > I am reading api docs and not getting exactly how to do that. 
> > Can anyone shed some light on this?
> > 
> > Thanks
> > Reddy
> > 
> > > -----Original Message-----
> > > From:     Matt Raible [SMTP:[EMAIL PROTECTED]
> > > Sent:     Tuesday, December 09, 2003 2:57 PM
> > > To:       [EMAIL PROTECTED]
> > > Subject:  RE: [struts-menu] Create tabbed menus 
> > dynamically based on
> > > user access level
> > > 
> > > 1. The tabbed menu matches the selected tab based on URL.  In the 
> > > following URL, the "Home" tab will be selected because it 
> > has the same 
> > > URL as the on in your browser:
> > > 
> > > http://raibledesigns.com/struts-menu/tabbedMenu.jsp?Home
> > > 
> > > 2.  If you're using container-managed security, you can specify a 
> > > comma-delimited "roles" attribute in your Menu's or Item's (in 
> > > menu-config.xml).  If not, you have two other choices:
> > >   1. Use the built-in permissions mechanism 
> > > (http://struts-menu.sourceforge.net/security.html).
> > >   2. Use the Velocity templates and add your own custom logic to 
> > > hide/show menus based on request/session attributes.
> > >   3. Create your own Menu Repository and stuff it in the 
> > > application/session/request with the key 
> > > "net.sf.navigator.menu.MENU_REPOSITORY" and the lowest 
> > level one will 
> > > be used over the default (in application scope at startup).
> > > 
> > > HTH,
> > > 
> > > Matt
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
> > > > [mailto:[EMAIL PROTECTED] On Behalf Of 
> > > > Pingili, Madhupal
> > > > Sent: Tuesday, December 09, 2003 12:41 PM
> > > > To: '[EMAIL PROTECTED]'
> > > > Subject: [struts-menu] Create tabbed menus dynamically based 
> > > > on user access level
> > > > 
> > > > 
> > > > Hello all,
> > > > Now that I can make Struts Menu 2.0 work in my web application,
> > > > I have couple of questions on tabbed menus:
> > > > 1. How do I make menu look like selected when I display 
> > first time?
> > > >    For example, in struts-menu.war example application, when 
> > > > we click on 
> > > >    tabbedMenuExample option, it is displaying the "Home" 
> > menu page. 
> > > >    But it is not showing like "Home" option is selected.
> > > >    Now you have to click on "Home" menu option to make it 
> > selected.
> > > > 
> > > > 2. How do I create tabbed menus dynamically based on user's
> > > > access level?
> > > >    We are storing user access levels in a complex Oracle database.
> > > >    I need to run a stored procedure to get all access levels.
> > > >    These access levels give the user permissions to see some 
> > > > menu options,
> > > >    to edit/delete actions etc.
> > > >   
> > > > Any ideas, suggestions or links to more documentation will be
> > > > helpful. 
> > > > 
> > > > Thanks
> > > > Reddy Pingili
> > > > 
> > > > 
> > > > 
> > > > -------------------------------------------------------
> > > > This SF.net email is sponsored by: IBM Linux Tutorials. Become an 
> > > > expert in LINUX or just sharpen your skills.  Sign up for 
> > IBM's Free 
> > > > Linux Tutorials.  Learn everything from the bash shell to 
> > sys admin. 
> > > > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371> 
> > &op=click
> > > > 
> > > > _______________________________________________
> > > > 
> > > > struts-menu-user mailing list
> > > > [EMAIL PROTECTED]
> > > > https://lists.sf.net/lists/listinfo/struts-> menu-user
> > > > 
> > > 
> > > 
> > > 
> > > 
> > > -------------------------------------------------------
> > > This SF.net email is sponsored by: IBM Linux Tutorials. Become an 
> > > expert in LINUX or just sharpen your skills.  Sign up for 
> > IBM's Free 
> > > Linux Tutorials.  Learn everything from the bash shell to 
> > sys admin. 
> > > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> > > _______________________________________________
> > > struts-menu-user mailing list
> > > [EMAIL PROTECTED] 
> > > https://lists.sf.net/lists/listinfo/struts-menu-user
> > 
> > 
> > -------------------------------------------------------
> > This SF.net email is sponsored by: IBM Linux Tutorials.
> > Become an expert in LINUX or just sharpen your skills.  Sign 
> > up for IBM's Free Linux Tutorials.  Learn everything from the 
> > bash shell to sys admin. Click now! 
> > http://ads.osdn.com/?ad_id=1278&alloc_id=3371> &op=click
> > 
> > _______________________________________________
> > 
> > struts-menu-user mailing list
> > [EMAIL PROTECTED] 
> > https://lists.sf.net/lists/listinfo/struts-> menu-user
> >  << Message: [struts-menu-devel] Dynamic Struts Menu >> 


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
struts-menu-user mailing list
[EMAIL PROTECTED]
https://lists.sf.net/lists/listinfo/struts-menu-user

Reply via email to