Re: (Newbie) Dot in property causing exception

Daniel Dekany <[email protected]> Mon, 6 Feb 2006 23:35:04 +0100
Newsgroups gmane.comp.text.fmpp
Message-ID <[email protected]>
Monday, February 6, 2006, 10:18:59 PM, Bruce Perryman wrote:


>  Hi,
>
> I'm a newbie, and I wondered if there was a way around this.
>
> An element in a list has a '.' in the name. When I try to evaluate
> the _expression in FreeMarker an exception is thrown.
>
> The List contains the value I.lastname. When I try to access it from wi=
thin the
> =A0<#list name as x> as
>
> "${x.I.lastname}"
>
> FreeMarker tells me that x.I is undefined. Other than changing the
> element name, is there a way to do this?

??? Huh? I see you are newbie, as you use some kind of terminology that
I don't understand. :) List items doesn't have a name. They have an
integer index. Anyway, if what you really want is the read a subvariable
whose name contains dot (or whatever special character), then here is
how to do it:

  foo["x.y.z"]

This will get the subvariable of "foo", which is called x.y.z.

--=20
Best regards,
 Daniel Dekany



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642