You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Matthew Van Horn <ma...@yahoo.com> on 2004/08/03 00:23:32 UTC

dynamic property names?

Can you use dynamic property names in Velocity?
I mean something like:

#set($foo = "xyzzy")
the value of $foo is $myObject.$foo

where that resolves to $myObject.getXyzzy()

I'm going to check this via trial and error, but any help is
appreciated, and might save me some time and trouble.

-- 
Matthew Van Horn <ma...@yahoo.com>


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


Re: dynamic property names?

Posted by Nathan Bubna <na...@esha.com>.
Matthew Van Horn said:
> Can you use dynamic property names in Velocity?
> I mean something like:
>
> #set($foo = "xyzzy")
> the value of $foo is $myObject.$foo
>
> where that resolves to $myObject.getXyzzy()

no.  you can't do this without using a tool like the RenderTool or
ViewRenderTool in the VelocityTools project.

> I'm going to check this via trial and error, but any help is
> appreciated, and might save me some time and trouble.

Nathan Bubna
nathan@esha.com


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