aspose file tools*
The moose likes Struts and the fly likes Struts Menu is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Menu is not working" Watch "Struts Menu is not working" New topic
Author

Struts Menu is not working

knazeer ahmed
Greenhorn

Joined: Sep 09, 2008
Posts: 8
Hi,
I am using structs-menu2.4.3 with struts 2.0. I created menu tree as below:
MenuItem is a VO.
MenuItem item = new MenuItem();
item.setName("Create");
//item.setParentName("Create");
item.setTitle("Create");
item.setId(new Long(1));
item.setLocation("loginAction.do?loginmethod=modifyBill");
item.setDescription("Create");
sampleList.add(item);

MenuItem item1 = new MenuItem();
item1.setName("Create/Modify");
item1.setParentName("Create");
item1.setTitle("Create/Modify");
item1.setId(new Long(2));
item1.setLocation("loginAction.do?loginmethod=modifyBill");
item1.setDescription("Create/Modify");

sampleList.add(item1);

Iterator iterator = sampleList.iterator();
while (iterator.hasNext()) {

//SsoMenuItem menuItem = (SsoMenuItem) iterator.next();
MenuItem menuItem = (MenuItem) iterator.next();
MenuComponent mc = new MenuComponent();
String name = menuItem.getName();
mc.setName(name);
String parent = menuItem.getParentName();
if (parent != null) {
MenuComponent parentMenu = repository.getMenu(parent);
if (parentMenu == null) {
parentMenu = new MenuComponent();
parentMenu.setName(parent);
repository.addMenu(parentMenu);
}
mc.setParent(parentMenu);
}

System.out.println(title);
System.out.println(mc.getName());
mc.setTitle(title);
String location = menuItem.getLocation();
mc.setLocation(location);
String id = menuItem.getId().toString();
mc.setId(id);
repository.addMenu(mc);
}

ServletContext application = request.getSession().getServletContext();
MenuRepository defaultRepository = (MenuRepository) application.getAttribute(MenuRepository.MENU_REPOSITORY_KEY);
repository.setDisplayers(defaultRepository.getDisplayers());

session.setAttribute("repository", repository);


Navig.jsp :

<div class="dynamicMenu">
<script type="text/javascript">
<menu:useMenuDisplayer name="Velocity" config="/templates/xtree.html"
repository="repository">
<c:forEach var="menu" items="${repository.topMenus}">
<menu-el:displayMenu name="${menu.name}"/>
</c:forEach>
</menu:useMenuDisplayer>
</script>
</div>

Still i am not able to see the tree on my JSP. UI shows some thing like below if i remove <script type="text/javascript"> tag.

var Create = new WebFXTree('Create','loginAction.do?loginmethod=modifyBill'); var Create/Modify = new WebFXTreeItem('Create/Modify','loginAction.do?loginmethod=modifyBill'); Create.add(Create/Modify); document.write(Create);



Please help me.


Thanks and Regards,
Nazeer
francis xavier
Greenhorn

Joined: Nov 19, 2012
Posts: 1
Hi Did you solve this issue?
I am also facing the same issue.
Thanks in advance.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Menu is not working
 
Similar Threads
Couldn't get Menu Composite Iterator (HeadFirst Design Pattern) to work
what's wrong with this simple code
struts menu display problem
menu creation
Problem with struts-menu for second level submenu