Re: struts-menu release 2.2, dynamic menu

Matt Raible <lists-T7vlz3gD7BdF/EzeuO4KJwC/[email protected]>
Newsgroups gmane.comp.java.struts-menu.user
Message-ID <[email protected]>
Make sure you have the proper .js file included in your page.  Do you  
see any JavaScript errors?  You might want to view-source and compare  
the output from the two menus.

Matt

On Apr 27, 2004, at 2:09 AM, Khalif, Ella wrote:

> Hello!
>
> I have one problem with dynamic menu. I took your example  
> (http://demo.raibledesigns.com/appfuse/dynamicMenu.jsp) und made my  
> own menu, but without DB Access. My menu didn’t expand. I think, that  
> by onClick event for activator, it wasn’t send any request  and  
> javascript function initializeMenus wasn’t executed. Why? What is not  
> correct? Help me please! The code:
>
>  
>
> <%@ include file="/tiles/parts/jsp_header.inc" %>
>
> <%-- Importieren aller Tiles-Attribute in den Page-Scope --%>
>
> <tiles:importAttribute /><%
>
> net.sf.navigator.menu.MenuRepository repository = new  
> net.sf.navigator.menu.MenuRepository();
>
> net.sf.navigator.menu.MenuRepository defaultRepository =  
> (net.sf.navigator.menu.MenuRepository)application.getAttribute(net.sf.n 
> avigator.menu.MenuRepository.MENU_REPOSITORY_KEY);
>
> repository.setDisplayers(defaultRepository.getDisplayers());
>
> %>
>
>  <c:forEach var="menu_element" items="${menu_elements}"  
> varStatus="itStatus">
>
>   <ips:importMap value="${menu_element}">
>
>  <c:set var="name" value="${menu_id}"/>
>
>  <c:set var="parentname" value="${parent_id}"/>
>
>  <c:set var="title" value="${label_key}"/>
>
>  <c:if test="${header_key !=null}"><c:set var="header_key1"  
> value="${header_key}"/></c:if>
>
>  <c:if test="${header_key ==null}">
>
>  <c:set var="current_cell_styleclass"  
> value="${cell_styleclass_template}${menu_level}"/>
>
>  <c:set var="current_link_styleclass"  
> value="${link_styleclass_template}${menu_level}"/>
>
>  <c:set var="current_on_mouse_out_handler"  
> value="${on_mouse_out_handler}"/>
>
>  <c:if test="${highlight_selected=='true'}"><ips:isMenuItemSelected  
> item="${menu_id}">
>
>  <c:set var="current_cell_styleclass"  
> value="${selected_cell_styleclass_template}${menu_level}"/>
>
>  <c:set var="current_link_styleclass"  
> value="${selected_link_styleclass_template}${menu_level}"/>
>
>  <c:set var="current_on_mouse_out_handler"  
> value="${on_mouse_out_handler_selected}"/>
>
>  </ips:isMenuItemSelected></c:if>
>
>  <c:choose><c:when test="${external_link!=null}"><c:set var="url"  
> value="${external_link}"/></c:when>
>
>  <c:otherwise><c:set var="page"  
> value="${menu_link}"/></c:otherwise></c:choose>
>
>  <%
>
>      String name = (String)pageContext.getAttribute("name");
>
>     net.sf.navigator.menu.MenuComponent mc = repository.getMenu(name);
>
>     if (mc == null){
>
>       mc = new net.sf.navigator.menu.MenuComponent();
>
>       mc.setName(name);
>
>     }
>
>     String title = (String)pageContext.getAttribute("title");
>
>     if (title != null)
>
>       mc.setTitle(title);
>
>  
>
>     String jpage = (String)pageContext.getAttribute("page");
>
>  
>
>     if (jpage != null){
>
>          mc.setPage(jpage);
>
>     }else{
>
>        mc.setOnclick("javascript:initializeMenus()");
>
>       }
>
>     String parent = (String)pageContext.getAttribute("parentname");
>
>       if (parent != null) {
>
>             net.sf.navigator.menu.MenuComponent parentMenu =  
> repository.getMenu(parent);
>
>             if (parentMenu == null){
>
>                 System.out.println("Parent MENU "+ parent + " not  
> exist");
>
>                   parentMenu = new  
> net.sf.navigator.menu.MenuComponent();
>
>                   parentMenu.setName(parent);
>
>                   repository.addMenu(parentMenu);
>
>             }
>
>             mc.setParent(parentMenu);
>
>        }
>
>        System.out.println("MENU");
>
>        System.out.println("!"+mc.getName()+"!");
>
>        System.out.println(mc.getTitle());
>
>        System.out.println(mc.getPage());
>
>        System.out.println(mc.getLocation());
>
>        System.out.println(mc.getUrl());
>
>        System.out.println(mc.getOnclick());
>
>        if (mc.getParent() != null)
>
>             System.out.println("!"+mc.getParent().getName()+"!");
>
>        else
>
>             System.out.println(mc.getParent());
>
>  repository.addMenu(mc);%>
>
>  </c:if>
>
>  </ips:importMap>
>
>  </c:forEach>
>
>  <% pageContext.setAttribute("repository",repository);%>
>
> <table id="<c:out value="${table_id}"/>" cellpadding="0"  
> cellspacing="0">
>
> <menu:useMenuDisplayer name="ListMenu" repository="repository"  
> permissions="rolesAdapter" bundle="org.apache.struts.action.MESSAGE">
>
> <c:if test="${header_key1!=null}"><tr><td class="<c:out  
> value="${header_cell_styleclass}"/>"><span class="<c:out  
> value="${header_span_styleclass}"/>"><bean:message  
> key="${header_key1}"/></span></td></tr></c:if>
>
> <tr><td class="ips-menu-separator"></td></tr>
>
> <tr><td class="ips-menu-separator"></td></tr>
>
> <c:forEach var="menu" items="${repository.topMenus}">
>
> <tr><td colspan="" rowspan="" width="">
>
>             <div id="hab-menu-leer-container" >
>
>                   <input type="image" border="0" src="<html:rewrite  
> page="/images/navlinestart.gif"/>">
>
>             </div>
>
>       </td>
>
>       </tr>     
>
>      <tr><td class="<c:out value="${current_cell_styleclass}"/>"  
> onMouseOver="<c:out value="${on_mouse_over_handler}"/>"  
> onMouseOut="<c:out value="${current_on_mouse_out_handler}"/>">
>
>      <menu-el:displayMenu name="${menu.name}"/>
>
>     </td></tr>
>
> </c:forEach>
>
> </menu:useMenuDisplayer>
>
> <tr>  <td colspan="" rowspan="" width="">
>
>             <div id="hab-menu-leer-container" >
>
>                   <input type="image" border="0" src="<html:rewrite  
> page="/images/navlinestart.gif"/>">
>
>             </div>
>
>       </td>
>
>       </tr>
>
> </table>
>
> <script type="text/javascript">
>
> initializeMenus();
>
> </script>
>
>  
>
>  
>
> Thank you very much!!!!
>
>  



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id149&alloc_id66&op=click
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.