Re: Listing enumerations
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
What's the Java class and method behind database.displayTables?
--
Best regards,
Daniel Dekany
Friday, March 9, 2012, 6:31:24 PM, Tim Pizey wrote:
> 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=""> </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
------------------------------------------------------------------------------
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/