Hi Matt,

On 14 Feb 2008 at 9:29, Matt Raible wrote:

> 
> On Feb 14, 2008, at 9:24 AM, Rob Hills wrote:
> 
> > Rob Hills wrote:
> >> BTW, is it possible to have the main part of the menu in the  
> >> Application (as it is currently) and then a submenu in the  
> >> Session?  Does the <menu:displayMenu> tag just hunt through the  
> >> first repository it finds, or can it be pointed at a different  
> >> repository?
> > Just to clarify this question a bit further - from what you said, I  
> > can pull a bunch of menu items inside a useMenuDisplayerTag with a  
> > "repository" attribute, but I guess I was wondering if the  
> > "repository" attribute might be able to be used in the displayMenu  
> > tag - it would be pretty cool to be able to pull the common parts  
> > of the menu from the Application and the user-specific bits from  
> > the session, via a "repository" attribute in each displayMenu tag.
> 
> This feature is currently unsupported. However, you could grab the  
> repository in a filter and re-build it with the stock+custom version.
> 
> This code might help to see how to grab the repository and add menus  
> to it:
> 
> http://demo.raibledesigns.com/struts-menu/dynamicMenu.jsp

Thanks for that, I'd actually borrowed heavily from the example for my original 
code.

AFAICT, the steps involved go something like this:  

1. Trap the user login event in my ApplicationListener class 
2. At the time of login, make a copy of the Application menuRepository in the 
App context and put the copy into the session.
3. Add the required items to the session copy of the MenuRepository.

I've done 1 and 3 OK.  WRT step 2, I believe I need to copy the MenuRepository 
object as otherwise when I put it in the session, 
that's just a pointer to the original object in the App Context and any mods I 
make to it will affect the whole app.  I've looked at the 
javadoc and it appears the only way I can copy the object is to troll through, 
recursively copying menu items and attributes.  Is 
there any other way I've not discovered (or any cool new Java trick to do a 
complete deep copy of any object)?

TIA,


Rob Hills
Waikiki, Western Australia
Mobile +61 (412) 904-357
Fax: +61 (8) 9529-2137


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to