Expecting a string, date or number here, Expression x is instead a freemarker.template.TemplateBoole
来源:互联网 发布:手机淘宝分期付款流程 编辑:程序博客网 时间:2024/06/03 12:28
今天在弄freemarker + springmvc +jdbc的时候,加了几个字段,其中有一个Boolean类型的数据,结果出现一下错误
难道是freemarker在使用标签使用的时候,不支持boolean,只支持string, date or number ,我个去,整半天我还以为是我代码写错了,check了半天。
Expecting a string, date or number here, Expression x is instead a freemarker.template.TemplateBoole
难道是freemarker在使用标签使用的时候,不支持boolean,只支持string, date or number ,我个去,整半天我还以为是我代码写错了,check了半天。
特地在此总结下freemarker使用一些细节
1、Freemarker对于null的结果会抛异常,需要自己处理。比如:
! 输出空格
!'the default while empty' 指定一个为空时候的默认值
2、Freemarker对于boolean的结果会抛异常,需要自己处理。比如:
cfg.setBooleanFormat("true,false"); 在我这边尝试,没有效果,还是需要额外处理boolean的输出
<#if bean.bolField>true<#else>false</#if> 用if else 判断一下,输出自定义的值
${bean.bolField?string(“yes”,”no”)} 转义
- Expecting a string, date or number here, Expression x is instead a freemarker.template.TemplateBoole
- Expecting a string, date or number here, Expression x is instead a freemarker.template.TemplateBoole
- Expecting a string, date or number here, Expression x is instead a freemarker.ext.beans.BooleanModel
- Expecting a string, date or number here, Expression jsonlist is instead a freemarker
- expected number,sequence,or string.map evaluated instead of freemarker.template.smplehash
- test if a string is a number
- freemarker.core.NonStringException: Error on line 346, column 109 in post.html Expecting a string, d
- Here is a 10-line template that can solve most 'substring' problems
- Here is a 10-line template that can solve most 'substring' problems
- Judge whether a telephone number is right or not
- Here is a riveting caregiver income jobs
- SVN E200009: 'xxx@2x.png': a peg revision is not allowed here
- Velocity A template engine OR A Rule engine OR Both
- freemarker.template.TemplateException: Expected string. column.nullable evaluated instead to freemar
- Ruby:The provided regular expression is using multiline anchors (^ or $), which may present a securi
- Find whether a given number is a power of 4 or not
- CareerCup Find whether a given number is a perfect square or not.(Addition and Subtraction only)
- int() argument must be a string or a number, not 'SimpleLazyObject'
- 开始学习android开发
- 2013-08-11 Hello word|异常|代码书写规范|编译器虚拟机|注释|命名规则|数据类型|不常用的运算符|语法|
- ntpq –p命令查看连接的NTP服务器
- java异常处理
- FZOJ2110 star(DFS)
- Expecting a string, date or number here, Expression x is instead a freemarker.template.TemplateBoole
- 01.UTinventory多用户进销存系统概述
- java文件读取
- 映射组件属性之④:组件作为Map的索引
- 题目1443:Tr A
- JAVA & ANT 入门
- Java基础知识——Java语言基础
- 黑马程序员-C#中的方法与飞行棋游戏设计思路笔记
- CentOS 6.4 开机 unexpected inconsistency run fsck manually 问题的修复