Re: Display String array in FTL
strutstwouser <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
I looked at the PostalAddress object closer and find that in addition to the
usual get/sets :
public java.lang.String[] getAddressLine() {
return addressLine;
}
and
public void setAddressLine(java.lang.String[] addressLine) {
this.addressLine = addressLine;
}
there are also methods like :
public java.lang.String getAddressLine(int i) {
return addressLine[i];
}
and
public void setAddressLine(int i, java.lang.String value) {
addressLine[i] = value;
}
When i removed these additional get/sets, it worked fine.
I've attached the stacktrace ;
http://www.nabble.com/file/p23703551/stacktrace.txt stacktrace.txt the NPE
is at the bottom. Sorry i initially thought that was the primary exception.
Thanks,
Joseph
Daniel Dekany wrote:
>
> 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
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>
>
--
View this message in context: http://www.nabble.com/Display-String-array-in-FTL-tp23632761p23703551.html
Sent from the freemarker-user mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com