You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Ro...@youts.com on 2001/04/10 17:06:05 UTC

How populate navigation templates?

How populate navigation templates?


We want to use only 1 Top-Navigation screen, called DefaultTop.vm. 
Included in that template we have a PopUp selection list. 
Depending on the selected option we call different screens and
preselect it baseded on actual page. 
So we have to pass a parameter from jave- to template-level


We tried it the same way that works for screens properly:

Create a class with the same name and position (in the 
directory-hirarchie) and use the
context. 

The problem is Navigation.doBuild only has RunData. 
On the other hand VelocityNavigation.doBuild has 2 constructor, and also 
one that has 
the context.
But in reality turbuine/velocity seems only to use the simple one.
data.getPage().getBody().addElement works, but is not really what we 
wanted.
Additionally we get an error in the browser:
"Error processing navigation template:/DefaultTop.vm using module: 
DefaultTop"
We are not able to pass a parameter by context...

Has anyone an idea?



\webapps\test\templates\navigations\DefaultTop.vm
\webapps\edesk3\WEB-INF\src\java\org\youts\test\modules\navigations\DefaultTop.java

public class DefaultTop extends VelocityNavigation
{
    public ConcreteElement doBuild( RunData data, Context context)
        throws Exception
    {
        data.getPage().getBody().addElement("TEST RF1");
                  context.put("rf", "TEST RF1_B");
        return null;
    }
 
    public ConcreteElement doBuild( RunData data)
        throws Exception
    {
          data.getPage().getBody().addElement("TEST RF2");
                  context.put("rf", "TEST RF2_B");
        return null;
    }
}

TurbineResources.properties:
services.TurbineTemplateService.default.navigation=VelocityNavigation

Other question: What's the best way to pass parameters from one navigation 
template to another?


Greets
Roland

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


Re: How populate navigation templates?

Posted by Sean Legassick <se...@informage.net>.
In message <OF...@com>, 
Roland.Fehr@youts.com writes
>How populate navigation templates?

[]

>We tried it the same way that works for screens properly:
>
>Create a class with the same name and position (in the
>directory-hirarchie) and use the
>context.

Yep, this is what works for me.

[]

>public class DefaultTop extends VelocityNavigation
>{
>    public ConcreteElement doBuild( RunData data, Context context)

This should be
   "public void doBuildTemplate(RunData data, Context context)"

>        throws Exception
>    {
>        data.getPage().getBody().addElement("TEST RF1");

And why are you trying to add content to the page here? That's what the 
template is for...

>                  context.put("rf", "TEST RF1_B");
>        return null;
>    }

>Other question: What's the best way to pass parameters from one navigation
>template to another?

In the context.

-- 
Sean Legassick
sean@informage.net
         Als Mensch kann mir nichts menschliches Fremd sein

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