Re: Display String array in FTL

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Wednesday, May 20, 2009, 6:57:16 PM, strutstwouser wrote:

> Yes, the array has data.

And even if it hadn't, it should be an InvalidReferenceException,
never an NPE. But your report missed the exception trace with
locations... it's hard to find out what caused the NPE this way.

> I printed the same using Struts2 tag , like :
>
> <@s.property
> value="model.borrowers[0].party.legalAddress.addressLine[0]" />
>
> and it gives the value fine.
>
> The latest code i was trying was : 
>
> <#if model.borrowers[0].party.legalAddress.addressLine?exists>
>
> <#assign addressLines =
> model.borrowers[0].party.legalAddress.addressLine>
>
> <#list addressLines as addressLine>                                
>                                                         AddressLine0->  ${addressLine}
> </#list>
> </#if>
>
> This breaks with the error : 
>
> freemarker.ext.servlet.ServletContextHashModel
>  cause: freemarker.template.TemplateModelException: ?size is unsupported
> for: freemarker.ext.beans.SimpleMethodModel

At which template line? In general, just include the whole stack trace
for all reports... maybe it's needless, but often it helps.

>>> There shouldn't be. Are you 100% sure the array has a first item which
>>> is not Java null, etc.?
>> 
>> Oh, and even if you have one of those, it should still throw
>> freemarker.core.InvalidReferenceException, not NPE. So... maybe the
>> problem is not exactly there, just around somewhere?

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
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.