You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by rjain <rj...@yahoo.com> on 2006/11/21 22:49:34 UTC

Velocity Variables across Templates

Hi 

I have two templates Template.vm and Template1.vm

I define a variable $fooMap which is a hashMap in one Template. It is not
visible in the other template. 

Does the #set puts the variable in the Velocity Context. How do I define
global variables which are visible in all scopes. 

regards
Rajesh
-- 
View this message in context: http://www.nabble.com/Velocity-Variables-across-Templates-tf2681933.html#a7480721
Sent from the Velocity - User mailing list archive at Nabble.com.


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


Re: Velocity Variables across Templates

Posted by Nathan Bubna <nb...@gmail.com>.
You should just need to use the same context when merging both templates.

or, if you are using VelocityView, add an application-scoped
java.util.Hashtable to your toolbox and put variables you wish to be
global into that.

On 11/21/06, rjain <rj...@yahoo.com> wrote:
>
> Hi
>
> I have two templates Template.vm and Template1.vm
>
> I define a variable $fooMap which is a hashMap in one Template. It is not
> visible in the other template.
>
> Does the #set puts the variable in the Velocity Context. How do I define
> global variables which are visible in all scopes.
>
> regards
> Rajesh
> --
> View this message in context: http://www.nabble.com/Velocity-Variables-across-Templates-tf2681933.html#a7480721
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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