1. 程式人生 > >FreeMarker Error : left-hand operand: Expected a hash, but this evaluated to a sequence

FreeMarker Error : left-hand operand: Expected a hash, but this evaluated to a sequence

When I loop through a list in freemarker like below, it works fine.

<#list cModel.products as product>

But when I'm tring to assign the size of the list to a variable like,

 <#assign totalProducts = cModel.products.getList()?size>

I'm getting an exception from free marker like below

left-hand operand: Expected a hash, but this evaluated to a sequence

Any suggestions?