Re: Newbee - Velocity and Struts-Menu

Rob Moore <[email protected]>
Newsgroups gmane.comp.java.struts-menu.user
Message-ID <[email protected]>
Thomas Bednarz wrote:
> Can I use Struts-menu in a VELOCITY ONLY environment without ANY jsp tag 
> library? Are there any pointers about how to configure it and a sample 
> vm file?

I'm currently doing this from within Spring. I'm using the Velocity code 
from struts-menu and the menu repository object. It's been useful, but 
far less so than if I was using from within a JSP. Mostly I'm using it 
to avoid recreating the functionality provided by the menu repository.

So within my controller, I place the menu repository into the equivalent 
of the Struts form bean (the command object) like so:

MenuRepository menuRepository = (MenuRepository) servletContext			 
.getAttribute(MenuRepository.MENU_REPOSITORY_KEY);
command.setMenuRepository(menuRepository);

Then within my Velocity template I use displayMenu macro taken from 
struts-menu:

<div id="menuDiv">
	<ul id="menuList">
	#foreach ( $page in ["general", "items", "pricing", "sites"] )
		#displayMenu($command.menuRepository.getMenu($page) 0)
	#end
     </ul>
</div>

HTH,

Rob



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.