日期:2014-05-17  浏览次数:20702 次

${m.chindrenMenu[0].menuId?c}请问错在什么地方,求教
Underlying collection is not a list, it's org.hibernate.collection.PersistentSet
The problematic instruction:
----------
==> ${m.chindrenMenu[0].menuId?c} [on line 64, column 63 in userTemplate/kangbosi/head.html]
 in include "head.html" [on line 9, column 25 in userTemplate/kangbosi/content_title.html]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateModelException: Underlying collection is not a list, it's org.hibernate.collection.PersistentSet
at freemarker.ext.beans.CollectionModel.get(CollectionModel.java:126)
at freemarker.core.DynamicKeyName.dealWithNumericalKey(DynamicKeyName.java:111)
at freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:90)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Dot._getAsTemplateModel(Dot.java:74)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.NumericalBuiltins$cBI._getAsTemplateModel(NumericalBuiltins.java:156)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)
at freemarker.core.Environment.visit(Environment.java:417)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.Environment.include(Environment.java:1483)
at freemarker.core.Include.accept(Include.java:169)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.Environment.process(Environment.java:190)
at freemarker.template.Template.process(Template.java:237)
at org.apache.struts2.views.freemarker.FreemarkerResult.doExecute(FreemarkerResult.java:168)
at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
at 


------解决方案--------------------
Underlying collection is not a list, it's org.hibernate.collection.PersistentSet

它期望的是个 List 对象(或其子类),而你给他的是个PersistentSet
------解决方案--------------------
==> ${m.chindrenMenu[0].menuId?c} [on line 64, column 63 in userTemplate/kangbosi/head.html]
 in include "head.html" [on line 9, column 25 in userTemplate/kangbosi/content_title.html]
----------

给楼主指出错误的具体位置了。

Underlying collection is not a list, it's org.hibernate.collection.PersistentSet

这句指出错误原因,需要一个list,但类型确是PersistentSet
------解决方案--------------------
怎么学java呢?