Listing enumerations

Tim Pizey <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <CAArDnthb655TYbW=Yt1K92co+OfWu+-YZy-+y53_Ci0igGpvKg@mail.gmail.com>
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/
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.