Java Mailing List Archive

http://www.junlu.com/

Home » FreeMarker-user »

[FreeMarker-user] Listing enumerations

Tim Pizey

2012-03-09

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi,

I have a method which returns an Enumeration, but when it is rendered
with #list or #foreach
an exception is thrown:

?size is unsupported for: freemarker.ext.beans.OverloadedMethodModel
The problematic instruction:
----------
==> list melati.database.displayTables as table [on line 67, column 50
in org/melati/admin/Top.fml]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateModelException: ?size is unsupported for:
freemarker.ext.beans.OverloadedMethodModel
 at freemarker.ext.beans.OverloadedMethodModel.size (OverloadedMethodModel.java:149)
 at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:174)
 at freemarker.core.Environment.visit (Environment.java:428)

The template is:

<select name="table" OnChange="submit();" title="Select table to edit">
<#assign lasttype = "">
<#assign selected = false>
<#list melati.database.displayTables as table>
<#if !table.tableInfo.category.equals(lasttype)>
  <option value="">&nbsp;</option>
  <option value="">${table.tableInfo.category.name}</option>
  <option value="">============</option>
</#if>
<#assign lasttype = table.tableInfo.category>
<option value="${table.name}"
<#if !selected>
 <#if melati.table>
  <#if melati.table.equals(table)>
  selected="selected"
  <#assign selected = true>
 </#if>
 <#else>
  <#if table.getName().equals(admin.getPrimaryDisplayTable(melati))>
  selected="selected"
   <#assign selected = true>
  </#if>
 </#if>
</#if>> ${ml.rendered(table.displayName)}</option>
</#list></select>


I am using BeanWrapper.

The documentation for #list
http://freemarker.sourceforge.net/docs/ref_directive_list.html
says, as far as I can understand, that an enumeration and and iterator
should be usable.

Sorry if this is a newbie error.

thanks in advance
Tim



--
Tim Pizey
http://pizey.net/~timp

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
FreeMarker-user mailing list
FreeMarker-user@(protected)
https://lists.sourceforge.net/lists/listinfo/freemarker-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.