You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2010/12/22 22:07:22 UTC
Creating maps on the fly
All,
Using Velocity 1.4, I'm trying to create an in-page hash for quick
lookups. I have the following syntax:
#set($hash = { })
This is causing an error:
org.apache.velocity.exception.ParseErrorException: Lexical error:
org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line
6, column 17. Encountered: "{" (123), after : ""
at org.apache.velocity.Template.process(Template.java:141)
at
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:423)
...
I've even tried #set($hash = { "":"" }) just in case empty hashes aren't
supported, and I get a similar error.
When was this syntax added to Velocity? Am I just running a version that
is too old?
Thanks,
-chris
Re: Creating maps on the fly
Posted by Nathan Bubna <nb...@gmail.com>.
Yeah, i'm pretty sure maps came in 1.5, but that was eons ago, so i'm
not sure my memory is reliable.
On Wed, Dec 22, 2010 at 1:07 PM, Christopher Schultz
<ch...@christopherschultz.net> wrote:
> All,
>
> Using Velocity 1.4, I'm trying to create an in-page hash for quick
> lookups. I have the following syntax:
>
> #set($hash = { })
>
> This is causing an error:
>
> org.apache.velocity.exception.ParseErrorException: Lexical error:
> org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line
> 6, column 17. Encountered: "{" (123), after : ""
> at org.apache.velocity.Template.process(Template.java:141)
> at
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:423)
> ...
>
> I've even tried #set($hash = { "":"" }) just in case empty hashes aren't
> supported, and I get a similar error.
>
> When was this syntax added to Velocity? Am I just running a version that
> is too old?
>
> Thanks,
> -chris
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org