On 11/1/01 2:12 AM, "Hugh Brien" <[EMAIL PROTECTED]> wrote:

> Sorry for the stupid question, it's not what I intended.  Let me put it this
> way:
> Is is possible to pass parameters to an object that appears in a Velocity
> template.

Yes.

> One that pushed from the Velocity context ?

Yes again!

> How is that?

The magic of reflection :-)

If you place a little math tool in a velocity context, say:

context.put("mathTool", new MathTool());

Than in your template foo.vm you can use it's methods like so:

#set ($firstBorn = 10)
#set ($armAndLeg = 20)

Your new version of XP will cost $mathTool.add($firstBorn, $armAndLeg)
bucks!

That's just a simple example. Geir has some great docs which you can find
on the velocity site that go into much more detail.

http://jakarta.apache.org/velocity/user-guide.html

> r,
> Hugh
> 
> ----- Original Message -----
> From: "Jason van Zyl" <[EMAIL PROTECTED]>
> To: "Turbine Users List" <[EMAIL PROTECTED]>
> Sent: Wednesday, October 31, 2001 8:17 AM
> Subject: Re: Using complex classes and Velocity
> 
> 
>> On 10/31/01 11:13 AM, "Hugh Brien" <[EMAIL PROTECTED]> wrote:
>> 
>>> I have a O-R model with three classes that represent a many to many
>>> relationship.  When is the best way handle complex O-R mapping when
>>> using Velocity as the template engine.  I would have rather used JSP
>>> tempates but I have to work with Velocity
>>> ,
>> 
> 
>> Yaay! That's the first time I've heard that!
> 
>> 
>> If your O-R classes are like beans than you can use them in the velocity
>> context in a similar way you use your beans in JSP pages. You'll have to
>> provide a little more detail for useful help.
>> 
>> 
>>> Hugh
>>> 
>>> --
>>> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
>>> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>> 
>> --
>> 
>> jvz.
>> 
>> Jason van Zyl
>> 
>> http://tambora.zenplex.org
>> http://jakarta.apache.org/turbine
>> http://jakarta.apache.org/velocity
>> http://jakarta.apache.org/alexandria
>> http://jakarta.apache.org/commons
>> 
>> 
>> 
>> --
>> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
>> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to