velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nbu...@gmail.com>
Subject Re: How Can I Evaluate an Expression in Velocity?
Date Tue, 09 Dec 2008 16:03:17 GMT
That's pretty much just for within VTL; he was asking about an
external, Java API. :)

On Tue, Dec 9, 2008 at 7:55 AM, Will Glass-Husain
<wglasshusain@gmail.com> wrote:
> What about #evaluate?   (introduced in v 1.6)
>
> Will
>
> On Dec 9, 2008, at 6:56 AM, "Nathan Bubna" <nbubna@gmail.com> wrote:
>
>> There is a RenderTool class in the VelocityTools project which can do
>> most of this for you.
>>
>> On Mon, Dec 8, 2008 at 10:12 PM, bluejoe <bluejoe@sdb.cnic.cn> wrote:
>>>
>>> Hi All!
>>>
>>> In my project, I want to use Velocity to evaluate user-defined
>>> expressions like:
>>>
>>>  $a + $b
>>>
>>> How can I do that? It seems that I cannot use such an expression in a
>>> template directly. Then I tried to use #set directive:
>>>
>>>  #set ($temp = $a + $b)
>>>  $temp
>>>
>>> It works well, but I doubt if there is a method provided in Velocity such
>>> as:
>>>
>>>  Object o = Velocity.eval(vc, "$a + $b");
>>>
>>> Could you give me an answer on this point? I need your help. Thanks a
>>> lot!
>>>
>>> Best Regards,
>>> bluejoe
>>
>> ---------------------------------------------------------------------
>> 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
>
>

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


Mime
View raw message