[Geoserver-devel] [Geoserver-users] FTL can't access "features?size" in Geoserver 2.2

Hi Ruben,

I am getting the same issue as you. I am trying out the new Geoserver
2.2 with a
content.ftl and my WEB-INF/lib is using freemarker-2.3.18.jar

<#list features as feature> works fine but these don't work anymore
(used to be OK
with Geoserver 2.1.1):-

<#assign size = features?size>

and

<#assign x = features[0].LOCATION.value>

fail with Java exception:

java.io.IOException: Error occured processing content template
content.ftl for org.geoserver.wms.MapLayerInfo@anonymised.com Error occured
processing content template content.ftl for
org.geoserver.wms.MapLayerInfo@anonymised.com Expected number, sequence, or
string. features evaluated instead to
org.geoserver.template.DirectTemplateFeatureCollectionFactory$TemplateFeatureCollection
on line 18, column 14 in content.ftl.

See also my other post at:

http://osgeo-org.1560.n6.nabble.com/Freemarker-Template-Error-Geoserver-2-2-td5014712.html

Did you solve this problem?

Cheers,

Andrew

On 9/24/12, Rubén Illana <rig.icm@anonymised.com> wrote:

Hi everyone,

we are updating our deploys to new Geoserver 2.2 and we are having some
issues with FTL files and GetfeatureInfo requests.

The java exception we get is:

*java.io.IOException: Error occured processing content template content.ftl

for org.geoserver.wms.MapLayerInfo@anonymised.com Error occured processing
content template content.ftl for
org.geoserver.wms.MapLayerInfo@anonymised.com extended-hash or sequence.
features evaluated instead to
org.geoserver.template.DirectTemplateFeatureCollectionFactory$TemplateFeatureCollection
on line 1, column 21 in content.ftl. *

in line:*
*

*<#assign longitud = features?size>*

Once we split the list with

*<#list features as feature*>

there's no problem to access to feature element.

Is there any change about features object in Geoserver 2.2? We have tried
to change freemarker-2.3.18.jar to other versions (2.3.19 and 2.3.13) but
we've got the same result.

Any help will be appreciated, thanks in advance.