Dynamic Keys in a loop

CJ <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Hi,

All the data are String objects (Java)

The data model being passed to me has key-values as follows: The count indicates
how many name-email pairs are in the data model

CONTENT_DATA.AUTHOR_COUNT=2
CONTENT_DATA.AUTHOR_NAME1=John Doe
[email protected]
CONTENT_DATA.AUTHOR_NAME2=Jane Doe
[email protected]

In the FTL I want to loop through and output the name and email, something along
these lines

<#assign x=CONTENT_BEAN.AUTHOR_COUNT?number>
<#list 1..x as i>
<#if CONTENT_BEAN.AUTHOR_AUTHOR_NAME[i]?exists>Author Name:
${CONTENT_BEAN.AUTHOR_NAME[i]}</#if>
<#if CONTENT_BEAN.AUTHOR_EMAIL[i]"?exists>Author Email:
${CONTENT_BEAN.AUTHOR_EMAIL[i]}</#if>
</#list>

I've tried quite a few things but nothing seem to work, any help is greatly
appreciated.

Regards,
CJ


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
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.