FreeMarker 中数值比较的问题

dscideal 2012-03-14 09:55:11
以下是报错信息

FreeMarker template error!

The only legal comparisons are between two numbers, two strings, or two dates.
Left hand operand is a freemarker.ext.beans.NumberModel
Right hand operand is a freemarker.template.SimpleScalar


The problematic instruction:
----------
==> if (list.newstype.id==typeid) [on line 43, column 49 in WEB-INF/inc.ftl]


这里是inc.ftl文件

<#macro indexNews titlelength contLength typeid showCount type>
<#if frontNews??>
<#assign count = 0>
<#list frontNews as list>
<#if (type=="cptj")>
<#if (count<showCount)>
<#if (list.newstype.id==typeid)>
<#assign count = count+1>
<p>
……………………………………………………后面的就省略了
...全文
942 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Erikz 2014-03-06
  • 打赏
  • 举报
回复
怎么解决的啊
dscideal 2012-03-15
  • 打赏
  • 举报
回复
擦。。没人回了。不过已经解决了。。
dscideal 2012-03-14
  • 打赏
  • 举报
回复
我也知道两边是类型 不匹配,但怎么把typeid转换为int型的啊。。。总之两边类型一样就行了
dscideal 2012-03-14
  • 打赏
  • 举报
回复
inc.ftl文件发错了
<#macro indexNews titlelength contLength typeid showCount type>
<#if frontNews??>
<#assign count = 0>
<#list frontNews as list>
<#if (type=="cptj")>
<#if (count<showCount)>
<#if (list.newstype.id==typeid)>
<#assign count = count+1>
<p>

67,550

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧