Re: Using Variable as a List name
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Wednesday, October 7, 2009, 8:12:46 AM, rizzz86 wrote:
> Hi all,
>
> I am trying to use any variable as a name of list ... i.e.,
>
> <#foreach list1 in argList1>
> <#foreach list2 in list1>
> // The name of list2 is the first element of list1
> </#foreach>
> </#foreach>
>
> Following error occured if I pass variable as a list name "Expected
> collection or sequence. list1 evaluated instead to
> freemarker.ext.beans.StringModel"
>
> Can anyone help ?
The name of list2 is the first element of list1... huh? Anyway... is
it that argList1 is the list of the *names* of variables, which
variables are themselves lists? In that case, do this:
<#foreach list1Name in argList1>
<#foreach list2 in .vars[list1Name]>
...
</#foreach>
</#foreach>
If it's not what you meant... the trick is still certainly the
.vars[name] stuff.
> rizzz86
>
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference