You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Jaap van der Molen <mo...@mail.com> on 2004/04/20 18:02:01 UTC

MessageTool dynamic keys


Hi,

I wonder if it is possible to use dynamic keys instead of just String
literals in the MessageTool.get(...) methods? At the moment,
$text.get("mainPage.recentEntries") returns "Recent Entries", but
$text.get( $item.getName() ) returns "$text.get( $item.getName() )".

Alternatives like

$text.get( "$item.getName()" )

or

#set ($itemName = "$item.getName()" )
$text.get( "$itemName" )

dont't work either.

I am relatively new to the VLT, so perhaps I have missed something. Any
clues?

Thanks,
Jaap





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


Re: MessageTool dynamic keys

Posted by Mike Kienenberger <mk...@alaska.net>.
Jaap van der Molen <mo...@mail.com> wrote:
> I wonder if it is possible to use dynamic keys instead of just String
> literals in the MessageTool.get(...) methods? At the moment,
> $text.get("mainPage.recentEntries") returns "Recent Entries", but
> $text.get( $item.getName() ) returns "$text.get( $item.getName() )".

That generally means that either $item or $item.getName() is null.

It's perfectly-legal VTL.

Try outputting $item and $item.getName().

-Mike

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