Do you have a trimmed down version of your application (in WAR form),
I can try to reproduce this with?
Thanks,
Matt
On 12/8/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi all. I've spent a bunch of hours trying to figure out a javascript
error
> I'm facing when rendering a dynamically generated menu with the
CoolMenu4
> displayer. I'm generating my menu dynamically like this:
>
> // Create a new Menu repository
> MenuRepository repository = new MenuRepository();
>
> // Get the repository from the application scope - and copy the
> // DisplayerMappings from it.
> MenuRepository defaultRepository = (MenuRepository)
servletContext
>
> .getAttribute(MenuRepository.MENU_REPOSITORY_KEY);
> repository.setDisplayers(defaultRepository.getDisplayers());
>
> for (TipoCozinha tipoCozinha : tiposCozinha) {
>
> MenuComponent parentMenu = new MenuComponent();
>
> String codTipoCozinha = tipoCozinha.getCodigo
().toLowerCase();
>
> String menuUpImage = "images/menu/menu_up_" + codTipoCozinha
> + ".gif";
> String menuOverImage = "images/menu/menu_over_" +
codTipoCozinha
> + ".gif";
>
> parentMenu.setName("menu" + codTipoCozinha);
> parentMenu.setTitle(tipoCozinha.getDescricao().trim());
> // A imagem será usada como item do menu
> parentMenu.setImage(menuUpImage);
> // parentMenu.setHeight("24");
> // parentMenu.setWidth("40");
>
> parentMenu.setAltImage(tipoCozinha.getCodigo().toLowerCase());
> // Eventos para troca da imagem do item do menu
> // parentMenu.setOnmouseover("this.src=\"" + menuOverImage +
> "\"");
> // parentMenu.setOnmouseout ("this.src=\"" + menuUpImage +
> "\"");
>
> // Adiciona o item de menu pai no repositorio
> repository.addMenu(parentMenu);
>
> MenuComponent child = new MenuComponent();
>
> child.setName("frevo");
> child.setTitle("Frevo");
> // child.setImage(menuUpImage);
> child.setLocation("index.jsp");
> child.setWidth("200");
>
> child.setParent(parentMenu);
>
> logger.debug("Menu: " + parentMenu.getName()
> + " added to menu repository.");
> }
>
> // Setting repository at session scope
> session.put("repository", repository);
>
> It gets generated ok and I can render it using this code-fragment on a
jsp
> page:
>
>
> <%@ taglib uri="http://struts-menu.sf.net/tag" prefix="menu"%>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core "
> prefix="c"%>
>
> <menu:useMenuDisplayer name="CoolMenu4" repository="repository">
> <c:forEach var="menu" items="${repository.topMenus}">
> <menu:displayMenu name="${menu.name}"/>
> </c:forEach>
> </menu:useMenuDisplayer>
>
> The html output I get is:
>
>
>
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
> ">
>
> <html xmlns="http://www.w3.org/1999/xhtml"
> xml:lang="en" lang="en">
> <
> head>
> <title>CoolMenus4 (with Velocity) Example</title>
>
> <meta
> http-equiv="Content-Type" content="text/html; charset=utf-8"
> />
>
> <link rel="stylesheet" type=
> "text/css" media="screen" href="styles/global.css"
> />
>
> <link rel="stylesheet"
> type="text/css" media="screen" href=
> "styles/coolmenu.css" />
>
> <script type="text/javascript"
> src="scripts/coolmenus4.js"></script>
> <script
> type="text/javascript" src="scripts/cm_addins.js"></script
> >
>
> </head>
>
> <body>
>
> <!-- Custom Configuration for this example, must come after body to
work in
> IE -->
>
> <script type="text/javascript" src=
> "scripts/coolmenu4-config.js"></script>
>
> <script type=
> "text/javascript">
> <!--
>
>
> oCMenu.makeMenu('menuale','','<img
> src=\"images/menu/menu_up_ale.gif\" style=\":none\" />
> Alemã','','','','','','','','','','',0,'','','');
>
> oCMenu.makeMenu('frevo','menuale','Frevo','index.jsp
','','200','','','','','','','',0,'','','');
>
>
>
> oCMenu.makeMenu('menuara','','<img
> src=\"images/menu/menu_up_ara.gif\" style=\":none\" />
> Árabe','','','','','','','','','','',0,'','','');
>
> oCMenu.makeMenu('frevo','menuara','Frevo','index.jsp
','','200','','','','','','','',0,'','','');
>
>
>
> oCMenu.makeMenu('menuarg','','<img
> src=\"images/menu/menu_up_arg.gif\" style=\":none\" />
> Argentina','','','','','','','','','','',0,'','','');
>
> oCMenu.makeMenu('frevo','menuarg','Frevo','index.jsp
','','200','','','','','','','',0,'','','');
>
>
> oCMenu.construct();
> //-->
> </script>
>
>
>
>
>
> </body>
> </html>
> I compared one of this generated menu items with one from the sample
> CoolMenu4 displayer that comes bundle in struts-menu distribution, and
it
> has no differece at all.
>
> So, when I attempt to show a sub menu (during a onmouseover event) I got
the
> error:
>
> "o has no properties" at line 283 of coolmenus4.js that is this code
> fragment:
>
> }else{o = c.m[c.l[l].m[i]].o; o.hideIt();} }
>
> I don't know what it's happening and I'd be really thankfull if someone
> could help me to tackle this issue, once my due date to delivery the
project
> is getting closer. :-(
>
>
> Thx in advance...
>
>
>
>
>
>
>
>
>
> --
> Gabriel Pereira Borges
> __________________________________
> Work: 55-19-3865-9100 R-5608
> Fax: 55-19-3865-9110
> Home: 55-19-3828-2721
> Cel: 55-19-8115-9265
> E-mail: [EMAIL PROTECTED],
> [EMAIL PROTECTED],
> [EMAIL PROTECTED]
>
-------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
your
> opinions on IT & business topics through brief surveys - and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> _______________________________________________
> struts-menu-devel mailing list
> struts-menu-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/struts-menu-devel
>
>
>
--
http://raibledesigns.com
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
struts-menu-devel mailing list
struts-menu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/struts-menu-devel