|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Struts 2 dynamic menu issue
------------------------------------------------------------------------------ _______________________________________________ struts-menu-user mailing list struts-menu-user@... https://lists.sourceforge.net/lists/listinfo/struts-menu-user |
||
|
|
Re: Struts 2 dynamic menu issueInstead of registering it in your Spring applicationContext, I'd try using the MenuContextListener in your web.xml:
<listener> <listener-class>net.sf.navigator.menu.MenuContextListener</listener-class>
</listener> If that doesn't work, look for errors on startup - you might be missing some required JARs. Matt On Wed, Apr 1, 2009 at 10:39 PM, Jayaram Gokulan <karamvan@...> wrote:
------------------------------------------------------------------------------ _______________________________________________ struts-menu-user mailing list struts-menu-user@... https://lists.sourceforge.net/lists/listinfo/struts-menu-user |
||
|
|
|
Thanks a ton for your reply Matt. I do not get the error now, but it is redirecting to some other page, while i work on that.
Can you please guide me on how i can fetch my menu items from database instead of menu-config.xml
thanks,
|
Result result = (Result) pageContext.getAttribute("menus");
Map[] rows = result.getRows();
for (int i=0; i < rows.length; i++) {
Matt
Thanks a ton for your reply Matt. I do not get the error now, but it is redirecting to some other page, while i work on that.Can you please guide me on how i can fetch my menu items from database instead of menu-config.xmlthanks,
From: Matt Raible <matt@...>
Subject: Re: [struts-menu] Struts 2 dynamic menu issue
To: "General mailing list for Struts Menu" <struts-menu-user@...>
Date: Wednesday, April 1, 2009, 11:47 PM
Instead of registering it in your Spring applicationContext, I'd try using the MenuContextListener in your web.xml:javax.servlet.jsp.jstl.sql.Result;<listener><listener-class>net.sf.navigator.menu.MenuContextListener</listener-class></listener>If that doesn't work, look for errors on startup - you might be missing some required JARs.Matt
On Wed, Apr 1, 2009 at 10:39 PM, Jayaram Gokulan <karamvan@...> wrote:java.util.Map;
Hi,I use Struts2, Spring and hibernate in my project wanted to integrate Struts menu, the dynamic roles from oracle db. I followed the linkI copy pasted the code snippet into an actionimport
import
import
net.sf.navigator.menu.MenuComponent;import
net.sf.navigator.menu.MenuRepository;public
class MenuBuilderAction extends BaseAction {
/** * */ private static final long serialVersionUID = 1L;
MenuRepository
repository = new MenuRepository();
// Get the repository from the application scope - and copy the // DisplayerMappings from it.
MenuRepository
defaultRepository = (MenuRepository) getSession().getAttribute(MenuRepository.
MENU_REPOSITORY_KEY);
//repository.setDisplayers(defaultRepository.getDisplayers());
Result
result = (Result) getSession().getAttribute("menus");
Map[]
rows = result.getRows();{
for (int i = 0; i < rows.length; i++) {
MenuComponent mc =
new MenuComponent();Map row =
rows[i];String name = (String) row.get(
"name");mc.setName(name);
String parent = (String) row.get(
"parent_name");System.
out.println(name + ", parent is: " + parent); if (parent != null) {MenuComponent parentMenu =
repository.getMenu(parent); if (parentMenu == null) {System.
out.println("parentMenu '" + parent+
"' doesn't exist!"); // create a temporary parentMenuparentMenu =
new MenuComponent();parentMenu.setName(parent);
repository.addMenu(parentMenu);
}
mc.setParent(parentMenu);
}
String title = (String) row.get(
"title");mc.setTitle(title);
String location = (String) row.get(
"location");mc.setLocation(location);
repository.addMenu(mc);
}
getSession().setAttribute(
"repository", repository);}
}
My menu-config.xml<?
xml version="1.0" encoding="UTF-8"?><
MenuConfig> <Displayers> <Displayer name="Velocity" type="net.sf.navigator.displayer.VelocityMenuDisplayer"/> </Displayers> <Menus> <Menu name="MainMenu" title="mainMenu.title" page="/mainMenu.html" roles="ROLE_ADMIN,ROLE_USER"/>
</Menu> </Menus>
</
MenuConfig>
ApplicationConfig.xml
<
bean id="menu" class="net.sf.navigator.menu.MenuLoader"> <property name="menuConfig"> <value>/WEB-INF/menu-config.xml</value> </property></bean>When i run my jsp i getjavax.servlet.jsp.JspException: The menu repository could not be found.Kindly helpthanks,Gokul
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
_______________________________________________
struts-menu-user mailing list
struts-menu-user@...
https://lists.sourceforge.net/lists/listinfo/struts-menu-user
------------------------------------------------------------------------------
-----Inline Attachment Follows-----
_______________________________________________
struts-menu-user mailing list
struts-menu-user@...
https://lists.sourceforge.net/lists/listinfo/struts-menu-user
------------------------------------------------------------------------------
_______________________________________________
struts-menu-user mailing list
struts-menu-user@...
https://lists.sourceforge.net/lists/listinfo/struts-menu-user
| Free embeddable forum powered by Nabble | Forum Help |