velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Christian <...@xtian.org.uk>
Subject Re: Problems with ViewRenderTool
Date Fri, 10 Dec 2004 21:46:22 GMT
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


Mime
View raw message