You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Fernand Galiana <fg...@bea.com> on 2003/10/31 23:43:38 UTC

Gaining Access on the velocity context

I am trying to make a method call within a velocity template and would like
to be able to pass it the current context. How can I achieve that ??

For example:

    $fred_context.getFred( velocity_context )  <-- would like to be able to
pass in the root context




Re: Gaining Access on the velocity context

Posted by Brian Lloyd-Newberry <ne...@yahoo.com>.
Put the velocity context into itself before you merge the template.

  ctx.put( "velocity_context", ctx );

   You will need to change your velocity_context below to 
$velocity_context and it should work.

-Brian


Fernand Galiana wrote:
> I am trying to make a method call within a velocity template and would like
> to be able to pass it the current context. How can I achieve that ??
> 
> For example:
> 
>     $fred_context.getFred( velocity_context )  <-- would like to be able to
> pass in the root context
> 



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


Re: Gaining Access on the velocity context

Posted by Claude Brisson <cl...@savoirweb.com>.
just put a reference to the context inside itself (from java) :

context.put("context",context)

CloD

----- Original Message ----- 
From: "Fernand Galiana" <fg...@bea.com>
To: <ve...@jakarta.apache.org>
Sent: vendredi 31 octobre 2003 23:43
Subject: Gaining Access on the velocity context


> I am trying to make a method call within a velocity template and would like
> to be able to pass it the current context. How can I achieve that ??
> 
> For example:
> 
>     $fred_context.getFred( velocity_context )  <-- would like to be able to
> pass in the root context
> 
> 
> 
> 



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