Re: Nested Expression

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Tuesday, June 8, 2010, 12:09:49 AM, dougly wrote:

>
> Hi,
> I wonder if this nested expression is wokring.
> So far I got exception
>
> Caused by: freemarker.core.InvalidReferenceException: Expression
> types['${annoType}'] is undefined on line
>
> <#assign types =
>         {
>                 "TEXTBOX" : "com.vaadin.ui.TextField",
>                 "SELECT" : "com.vaadin.ui.Select"
>         }
>>
>
> <#assign annoType = anno.type>
> <#assign uiType = "types['${annoType}']" >

What you show here should work, however I doubt this was the template
that throw the above exception, as here in the last line you made the
whole types[...] stuff to be an unevaluated string. Anyway, what you
wanted in the last line is certainly this:

  <#assign uiType = types[annoType]>

No need for all the ${}-s and quotation marks. This should work as far
as annoType is either the string "TEXTBOX" or the string "SELECT".

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.