velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claude Brisson <cla...@renegat.net>
Subject RE: Problems with ViewRenderTool
Date Mon, 13 Dec 2004 16:36:26 GMT
none of your attempts was correct.
try :

$render.recurse("${D}${e}.${D}$text")

Claude

On Mon, 2004-12-13 at 17:20, Nadesan, Binu wrote:
> Hi All,
> 
> I tried using all these techniques with the render tool and nothing seems to
> work for me.
> 
> 1. $render.eval( "${e}.${text}" )
> 
> 2. #set($D = "$")
> #set($getText = "${D}e.$text")
> $render.eval($getText)
> 
> 3. #set($D = "$")
> $render.recurse("${D}e.$text")
> 
> Let's say that "foo" was the value of $text. And $e is the object
> In all the above cases, the final output is the string values of the object
> and the property "foo."
> 
> Something like 
> 
> "Billing.foo"
> "Shipping.foo"
> 
> If I type-in directly say $e.foo then I get the proper value. Like 
> "Billing"
> "Shipping"
> 
> 
> 
> Regards...
> Binu Nadesan.
> (513) 612-2206.
> 
> 
> -----Original Message-----
> From: Simon Christian [mailto:sjc@xtian.org.uk] 
> Sent: Friday, December 10, 2004 4:46 PM
> To: Velocity Users List
> Subject: Re: Problems with ViewRenderTool
> 
> Hi Binu,
> 
> I think the problem is that the parsers is trying to evaluate "$e.$text" 
> all in one go. The documentation suggests encapsulating the varriables 
> i.e. $render.eval( "${e}.${text}" )
> 
> http://jakarta.apache.org/velocity/tools/view/ViewRenderTool.html#eval()
> 
> Never actually used this particular 'tool myself, but I think that 
> should solve the problem.
> 
> - simon
> 
> Nadesan, Binu wrote:
> > Hi All,
> > 
> > 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.
> > 
> > Some how the tool is  not able to return the value of the object property.
> I
> > am I missing something here....
> > 
> > 
> > #macro (selectcontrol $name $selected $list $id $text)
> > 	#set($s="NULL" )
> > 	#set($s=$selected )
> > 	<select name="$name">
> > 	#foreach ($e in $list )
> > 	#set($v = $render.eval("$e.$id"))
> > 	<option value="$v"#if("$v"=="$s")
> > selected="selected"#end>$render.eval("$e.$text")</option>
> > 	#end
> > 	</select>
> > #end
> > 
> > Regards...
> > Binu Nadesan.
> > (513) 612-2206.
> > 
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org


---------------------------------------------------------------------
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