开发者社区> 问答> 正文

freemark遍历list报错?报错

freemark遍历list报错:

list:

xml配置文件:

<#list list as obj>

   INSERT INTO fd_motor_style(style_value, motor_id) VALUES('${obj.v}', ${obj.k})

</#list>

报错:

Expected collection or sequence. list evaluated instead to freemarker.template.SimpleScalar on line 1, column 8 in RAM_TEMPLATE.
The problematic instruction:
----------
==> list list as obj [on line 1, column 1 in RAM_TEMPLATE]
----------
Java backtrace for programmers:
----------
freemarker.template.TemplateException: Expected collection or sequence. list evaluated instead to freemarker.template.SimpleScalar on line 1, column 8 in RAM_TEMPLATE.
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:190)
at freemarker.core.Environment.visit(Environment.java:416)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
at freemarker.core.Environment.visit(Environment.java:209)
at freemarker.core.Environment.process(Environment.java:189)
at freemarker.template.Template.process(Template.java:237)
at com.fanda.core.freemarker.utils.FreeMarkerUtil.process(FreeMarkerUtil.java:217)
at com.fanda.core.freemarker.utils.FreeMarkerUtil.process(FreeMarkerUtil.java:198)
at com.fanda.core.commonquery.config.QueryConfig.getSqlInfo(QueryConfig.java:190)
at com.fanda.core.commonquery.config.QueryConfig.getSqlInfo(QueryConfig.java:183)
at com.fanda.core.helper.CommonQueryHelper.executeQuery(CommonQueryHelper.java:225)
at com.fanda.core.helper.CommonQueryHelper.executeQuery(CommonQueryHelper.java:263)
at com.fanda.core.module.res.query.QueryResourceType$QueryResourceHttpDispatcher.dispatch(QueryResourceType.java:119)
at com.fanda.core.module.res.query.QueryResourceType$QueryResourceHttpDispatcher.dispatch(QueryResourceType.java:1)
at com.fanda.core.module.runtime.Module.dispatch(Module.java:90)
at com.fanda.core.module.runtime.Module.dispatchResource(Module.java:80)
at com.fanda.core.module.dispatch.ModuleDispatchFilter.doFilter(ModuleDispatchFilter.java:80)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.fanda.core.filter.CoreFilter.doFilter(CoreFilter.java:174)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2503)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2492)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

展开
收起
爱吃鱼的程序员 2020-06-08 19:25:04 478 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    报错好啊 

    2020-06-08 19:25:24
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载