FreeMarker 实现递归出现的问题
<#macro reply replies> <ul> <#list replies as reply> <li> <div> <img alt="head" src="${base}/${reply.author.head!}" width="32px" height="32px"> </div> <div> <p>${reply.content}</p> </div> <#if (reply.replies?size>0)> <div> <@reply replies=reply.replies> </div> </#if> </li> </#list> </ul> </#macro>按道理这里木有错啊,可一直报错
com.jfinal.render.RenderException: freemarker.core.ParseException: Found unexpected directive: </#if> on line 86, column 25 Check whether you have a well-formed if-else block. at com.jfinal.render.FreeMarkerRender.render(FreeMarkerRender.java:128) at com.jfinal.core.ActionHandler.handle(ActionHandler.java:94) at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:65) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619)请各位前辈帮看一看
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
我也出现类似的问题,没改任何东西,以前好使的模板突然就不好使了。
今天出现类似情况了,
<@reply 后面少了结束符号 /.
那应该就是不能这样嵌套
解析没有通过,还没有执行,哪里来的死
循环
嗯,看了的,按道理不是这样的啊
看错误提示:
Check whether you have a well-formed if-else block.
这个是不是产生了无线循环了
<#if (reply.replies?size>0)>
没用啊,还是那样
先把这些改了试试:
${reply.author.head!} --> ${(reply.author.head)!}
${reply.content} --> ${(reply.content)!}
(reply.replies?size>0) --> (reply.replies?size) gt 0