Re: Display String array in FTL

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Wednesday, May 20, 2009, 1:09:58 PM, Daniel Dekany wrote:
> Wednesday, May 20, 2009, 12:22:27 PM, strutstwouser wrote:
>
>> Hi,
>>
>> I have an Address object that has an array of addressLines like : 
>>
>>     private java.lang.String[] addressLine;
>>
>> with appropriate getter/setter. The array has been populated with 1 element.
>>
>> When i try to give ${adresss.addressLine[0]} , it gave a
>> nullpointerexception
>>
>> However, the same notation ${borrowers0]} works fine if it's a List, like :
>>
>>     private List<Customer> borrowers;
>>
>> Is there anything different for String[] ?
>
> 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?

>> Thanks,
>> Joseph
>

-- 
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.