You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Harriett Y. Xing (HYX)" <Xi...@EBRINC.COM> on 2003/12/30 00:23:42 UTC

Dynamic Navigation

I had just set up TDK and created an app.  The next step was to modify the
navigation menu so that it could dynamically retrieve a list of options from
a database table.  I extended VelocityNavigation to create a new navigation
class and assigned it to services.VelocityService.default.navigation.
However, when I tried to run the app, I got the following message:

Error processing navigation template:/Menu.vm using module:
org.company.app.modules.navigation.Navigation


The new navigation class is:

package org.mycompany.newapp.modules.navigation;

import org.apache.turbine.modules.navigations.VelocityNavigation;
import org.apache.turbine.util.RunData;
import org.apache.velocity.context.Context;
import org.apache.torque.util.Criteria;
import org.apache.ecs.ConcreteElement;
import org.company.app.om.MenuItemsPeer;

import java.util.List;

public class Navigation extends VelocityNavigation{

public void doBuildTemplate(RunData runData, Context context) throws
Exception {
        super.doBuildTemplate(runData, context);

        Criteria criteria = new Criteria();
        List menuItems = MenuItemsPeer.doSelect(criteria);

        context.put("menuItems", menuItems);
    }


}


What am I missing?  

Thank you very much for your help.

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Dynamic Navigation

Posted by Scott Eade <se...@backstagetech.com.au>.
Without looking into your specific problem, a better solution to 
retrieving the MenuItems is to create a pull tool which will eliminate 
the need to have your Navigation class.  I think there was a recent 
thread on this list that discussed a couple of ways of customising the 
navigation, search the archive for these if you are interested.

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



Harriett Y. Xing (HYX) wrote:

>I had just set up TDK and created an app.  The next step was to modify the
>navigation menu so that it could dynamically retrieve a list of options from
>a database table.  I extended VelocityNavigation to create a new navigation
>class and assigned it to services.VelocityService.default.navigation.
>However, when I tried to run the app, I got the following message:
>
>Error processing navigation template:/Menu.vm using module:
>org.company.app.modules.navigation.Navigation
>
>
>The new navigation class is:
>
>package org.mycompany.newapp.modules.navigation;
>
>import org.apache.turbine.modules.navigations.VelocityNavigation;
>import org.apache.turbine.util.RunData;
>import org.apache.velocity.context.Context;
>import org.apache.torque.util.Criteria;
>import org.apache.ecs.ConcreteElement;
>import org.company.app.om.MenuItemsPeer;
>
>import java.util.List;
>
>public class Navigation extends VelocityNavigation{
>
>public void doBuildTemplate(RunData runData, Context context) throws
>Exception {
>        super.doBuildTemplate(runData, context);
>
>        Criteria criteria = new Criteria();
>        List menuItems = MenuItemsPeer.doSelect(criteria);
>
>        context.put("menuItems", menuItems);
>    }
>
>
>}
>
>
>What am I missing?  
>
>Thank you very much for your help.
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org