You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Akella, Sivanand (TCS)" <Si...@alcoa.com> on 2004/04/19 10:37:49 UTC

Velocity Context

Hi,

I am trying to get a reference to the velocity Context in my Java code. How can I get retrieve the existing contex? I want to add some objects to this context so that my view (.vm) can access those objects.

Thanks for the help,
Siva 

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


Re: Velocity Context

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
I'm hoping I didn't miss the point of the thread, but you could :

a) just add it when setting up before merge :

   VelocityContext vc = new VelocityContext();

   Foo f = new Foo();
   f.setContext(vc);

   vc.put("foo", f);


b) put the context in the context :

   VelocityContext vc = new VelocityContext();

   vc.put("context", vc);


and then access it from the template :

   $myFoo.setContext($context)


geir

On Apr 19, 2004, at 4:37 AM, Akella, Sivanand (TCS) wrote:

> Hi,
>
> I am trying to get a reference to the velocity Context in my Java 
> code. How can I get retrieve the existing contex? I want to add some 
> objects to this context so that my view (.vm) can access those 
> objects.
>
> Thanks for the help,
> Siva
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


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


Re: Velocity Context

Posted by Hans Prueller <ha...@gmx.net>.
you can use the context instance passing to the velocity engine with the
merge(Context c) method...

Am Mo, den 19.04.2004 schrieb Akella, Sivanand (TCS) um 10:37:

> Hi,
> 
> I am trying to get a reference to the velocity Context in my Java code. How can I get retrieve the existing contex? I want to add some objects to this context so that my view (.vm) can access those objects.
> 
> Thanks for the help,
> Siva 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org

-- 



====================

       http://hanzz.zapto.org

====================