velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nat...@esha.com>
Subject Re: hashtable dot in key
Date Thu, 05 Aug 2004 15:26:18 GMT
Magne Skjeret said:
> Magne Skjeret wrote:
...
> > I have a problem with looking up in a hashtable from the template when
> > the key has a dot in it.
> >
> > E.G
> > $!i18n.tab.type
> >
> > I understand why this example wont work, but is there a way I can do
> > this? Escaping the dot somehow.
>
> Of course using the get method direclty will work, but a cleaner
> solution is appreciated.

$!i18n.get('tab.type')

is a pretty clean solution IMHO.  anyway, there's no way to escape the dot.
so that's as clean as you'll get without changing the key or using some magic
key-appending object.  not that a magic key-appending object is really
"cleaner" in my opinion, but if you want an example of something like that,
then check out:

http://cvs.apache.org/viewcvs.cgi/jakarta-velocity-tools/src/java/org/apache/velocity/tools/struts/MessageTool.java?rev=1.14&view=auto

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


Mime
View raw message