velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <shinobu.ka...@gmail.com>
Subject Re: Problems with ViewRenderTool
Date Sat, 11 Dec 2004 01:10:43 GMT
Hi Binu,

> I have problem with the Velocity ViewRender tool. Please see the macro
> below...
> 
> The problem lies with the statement $render.eval("$e.$text")
> 
> Here $e is an object and $text contains a string value that is a property of
> the object.

Let's say that "foo" was the value of $text.  What you really want to
do is $render.eval("$e.foo").  You can either make such a variable and
pass it to $render.eval(), or you can use $render.recurse() to get the
result.

The first one works something like this:
#set($D = "$")
#set($getText = "${D}e.$text")
$render.eval($getText)

and the second like this:
#set($D = "$")
$render.recurse("${D}e.$text")

Of course, if the result contains VTL-ish stuff, you'll have to use
the first one because recurse() will keep on evaluating it.

Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <shinobu.kawai@gmail.com>

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


Mime
View raw message