最近在用freemarker的时候碰到一个问题,在<#list>中的元素用<#if>进行比较

<#if category.categoryId==categoryId>

结果出现问题如下:

freemarker.template.TemplateException: The only legal comparisons are between two numbers, two strings, or two dates.
Left  hand operand is a freemarker.template.SimpleNumber
Right hand operand is a freemarker.template.SimpleScalar
其原因为左边与右边的类型不一样,将它们类型转换成一样就OK了

 

 

 

 

相关文章:

  • 2021-07-14
  • 2021-04-11
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2021-12-02
  • 2021-08-12
  • 2022-12-23
猜你喜欢
  • 2021-09-19
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2021-06-03
  • 2021-10-16
相关资源
相似解决方案