Thanks a mil again for the quick reply, Matt!

Hm, that is why I'm a bit stuck. 

I have configured it in the web.xml as a listener:
        <listener>
           
<listener-class>net.sf.navigator.menu.MenuContextListener</listener-class>
        </listener>

The struts-menu works perfectly. I have a top bar navigation as well as a
site tab navigation. For the existing menu I used Velocity. No problem
there. 

My JSP for the site map looks like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ include file="/includes/decorator_includes.inc" %>
<%@ page import="java.util.Map,
                 javax.servlet.jsp.jstl.sql.Result,
                 net.sf.navigator.menu.MenuComponent,
                 net.sf.navigator.menu.MenuRepository"%>

[... some HTML ...]

<%
      MenuRepository repository = new MenuRepository();
       // Get the repository from the application scope - and copy the
       // DisplayerMappings from it.
       MenuRepository defaultRepository = (MenuRepository)
               application.getAttribute(MenuRepository.MENU_REPOSITORY_KEY);
       repository.setDisplayers(defaultRepository.getDisplayers());

[... rest of the java and HTML code ...]

But if I debug the code of the site map JSP, the "defaultRepository"
variable stays NULL. And so the repository is never filled.

I think I'm missing something here. 

In the stuts-menu.war this is defined via struts-config.xml as a plugin,
right? Could that be the problem with my setup?

Thanks,
Jonathan


Matt Raible-3 wrote:
> 
> Does Struts Menu work for you? If it does, then this code should work.
> How do you have it configured to load? Listener, plugin, etc?
> 
> Matt
> 
> On Thu, Aug 21, 2008 at 5:33 AM, JMllr <[EMAIL PROTECTED]> wrote:
>>
>> OK, I have embedded the code as suggested.
>> Well, I have kept it simple and directly inserted the java code into the
>> JSP
>> page. But when I debug the code, the repository variable stays NULL,
>> which
>> then results in an error.
>> I have "googled" this problem. And foremost solution for this seemed to
>> be
>> adding the common-lang into the class path. However, I already have my
>> common-lang.2.3.jar in the /WEB-INF/lib/ folder and this still keeps
>> happening.
>>
>> So I must be missing something and I'm not quite sure what. Any
>> suggestions
>> would be greatly appreciated.
>>
>> Thanks,
>> Jonathan
>>
>>
>> Matt Raible-3 wrote:
>>>
>>> You should be able to get the MenuRepository from the ServletContext
>>> and iterate over the menus to produce what you're looking for. Here's
>>> some example code that may help:
>>>
>>> http://demo.raibledesigns.com/struts-menu/dynamicMenu.jsp
>>>
>>> Matt
>>>
>>> On Tue, Aug 19, 2008 at 4:39 AM, JMllr <[EMAIL PROTECTED]> wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I use struts-menu in my web application to generate a tab menu and a
>>>> site
>>>> menu. All is working like a charm here.
>>>>
>>>> Now, I would like to use struts-menu to generate a site map for me. I
>>>> thought all the information is in the menu-config.xml already. So
>>>> wouldn't
>>>> it be handy to reuse this information?
>>>>
>>>> However, I have arrived at a dead end. Let me explain...
>>>>
>>>> The set up of my menu-config.xml is somewhat like this:
>>>>
>>>>   <?xml version="1.0" encoding="UTF-8" ?>
>>>>
>>>>    <MenuConfig>
>>>>
>>>>        <Displayers>...</Displayers>
>>>>        <Menus>
>>>>
>>>>        <Menu name="PublicMenu">
>>>>            <Item name="TabbedMenu1" title="Home" location="/home.jsp"
>>>> description="HomeMenu"/>
>>>>            <Item name="TabbedMenu2" title="About" location="/about.jsp"
>>>> description="AboutMenu"/>
>>>>        </Menu>
>>>>
>>>>        <Menu name="HomeMenu">
>>>>            <Item name="Something" title="Whatever" location="#"/>
>>>>        </Menu>
>>>>
>>>>        <Menu name="AboutMenu">
>>>>            <Item name="Something" title="Whatever" location="#"/>
>>>>        </Menu>
>>>>      </Menus>
>>>>    </MenuConfig>
>>>>
>>>> I know that there will always be a "PublicMenu" in my setup, but the
>>>> other
>>>> menus might change over time.
>>>>
>>>> I would like to use the description parameter to define jumps into the
>>>> other
>>>> menus, but I cannot seem to get this working. Is there any easy way to
>>>> change the current menu to a different one within the Velocity code
>>>> only
>>>> relying on the name string? (e.g. what would I have to write in
>>>> Velocity
>>>> or
>>>> Freemarker to reference the first item in "AboutMenu" when my
>>>> displayMenu
>>>> was called via "PublicMenu"?)
>>>>
>>>> Any help with this is much appreciated!
>>>>
>>>> Thanks,
>>>> Jonathan
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Generating-a-site-map-via-struts-menu-tp19047462p19047462.html
>>>> Sent from the struts-menu-user mailing list archive at Nabble.com.
>>>>
>>>>
>>>> -------------------------------------------------------------------------
>>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>>> challenge
>>>> Build the coolest Linux based applications with Moblin SDK & win great
>>>> prizes
>>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>>> world
>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>>> _______________________________________________
>>>> struts-menu-user mailing list
>>>> struts-menu-user@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/struts-menu-user
>>>>
>>>
>>>
>>>
>>> --
>>> http://raibledesigns.com
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great
>>> prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>> world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> _______________________________________________
>>> struts-menu-user mailing list
>>> struts-menu-user@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/struts-menu-user
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Generating-a-site-map-via-struts-menu-tp19047462p19086899.html
>> Sent from the struts-menu-user mailing list archive at Nabble.com.
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> struts-menu-user mailing list
>> struts-menu-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/struts-menu-user
>>
> 
> 
> 
> -- 
> http://raibledesigns.com
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> struts-menu-user mailing list
> struts-menu-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/struts-menu-user
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Generating-a-site-map-via-struts-menu-tp19047462p19103707.html
Sent from the struts-menu-user mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
struts-menu-user mailing list
struts-menu-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/struts-menu-user

Reply via email to