1、错误叙述性说明

五月 30, 2014 11:33:57 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error
严重: Template processing error: "Expected hash. flag evaluated instead to freemarker.template.TemplateBooleanModel$2 on line 21, column 8 in type.ftl." Expected hash. flag evaluated instead to freemarker.template.TemplateBooleanModel$2 on line 21, column 8 in type.ftl.
The problematic instruction:
----------
==> ${flag.color?string} [on line 21, column 6 in type.ftl]
---------- Java backtrace for programmers:
----------
freemarker.template.TemplateException: Expected hash. flag evaluated instead to freemarker.template.TemplateBooleanModel$2 on line 21, column 8 in type.ftl.
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:136)
at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.BuiltIn$stringBI._getAsTemplateModel(BuiltIn.java:408)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.Environment.process(Environment.java:199)
at freemarker.template.Template.process(Template.java:259)
at com.you.freemarker.FreemarkerTemplate.printFtl(FreemarkerTemplate.java:77)
at com.you.test.freemarker.FreemarkerTest.studentPrint(FreemarkerTest.java:172)
at com.you.test.freemarker.FreemarkerTest.testDataType(FreemarkerTest.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Expected hash. flag evaluated instead to freemarker.template.TemplateBooleanModel$2 on line 21, column 8 in type.ftl.
The problematic instruction:
----------
==> ${flag.color? string} [on line 21, column 6 in type.ftl]
---------- Java backtrace for programmers:
----------
freemarker.template.TemplateException: Expected hash. flag evaluated instead to freemarker.template.TemplateBooleanModel$2 on line 21, column 8 in type.ftl.
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:136)
at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.BuiltIn$stringBI._getAsTemplateModel(BuiltIn.java:408)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.Environment.process(Environment.java:199)
at freemarker.template.Template.process(Template.java:259)
at com.you.freemarker.FreemarkerTemplate.printFtl(FreemarkerTemplate.java:77)
at com.you.test.freemarker.FreemarkerTest.studentPrint(FreemarkerTest.java:172)
at com.you.test.freemarker.FreemarkerTest.testDataType(FreemarkerTest.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>freemarker基本数据类型</title> </head> <body>
张三丰 123,456 true Expected hash. flag evaluated instead to freemarker.template.TemplateBooleanModel$2 on line 21, column 8 in type.ftl.
The problematic instruction:
----------
==> ${flag.color?string} [on line 21, column 6 in type.ftl]
---------- Java backtrace for programmers:
----------
freemarker.template.TemplateException: Expected hash. flag evaluated instead to freemarker.template.TemplateBooleanModel$2 on line 21, column 8 in type.ftl.
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:136)
at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.BuiltIn$stringBI._getAsTemplateModel(BuiltIn.java:408)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:221)
at freemarker.core.Environment.process(Environment.java:199)
at freemarker.template.Template.process(Template.java:259)
at com.you.freemarker.FreemarkerTemplate.printFtl(FreemarkerTemplate.java:77)
at com.you.test.freemarker.FreemarkerTest.studentPrint(FreemarkerTest.java:172)
at com.you.test.freemarker.FreemarkerTest.testDataType(FreemarkerTest.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

2、错误原因

<#--定义布尔值-->
<#assign flag = true/>
${flag?string}
${flag.color? string}

由于flag已经定义为true。再次定义会报错

3、解决的方法

改动变量名。将flag改动为num

${(num.color)?

??

string}

成绩:false

版权声明:本文博主原创文章,博客,未经同意不得转载。

freemarker错误七的更多相关文章

  1. freemarker错误九

    1.错误叙述性说明 五月 30, 2014 11:52:04 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template p ...

  2. freeMarker(七)——程序开发指南之数据模型

    学习笔记,选自freeMarker中文文档,译自 Email: ddekany at users.sourceforge.net 1.基本内容 在入门章节中, 我们已经知道如何使用基本的Java类(M ...

  3. 【转】ubuntu源码编译安装php常见错误解决办法

    ./configure -prefix=/usr/local/php -with-config-file-path=/etc -with-mysql=mysqlnd -with-mysqli=mysq ...

  4. rsync错误日志

    问题一: @ERROR: chroot failed rsync error: error starting client-server protocol (code 5) at main.c(152 ...

  5. 关于master..xp_cmdshell’的几个错误_解决办法(转)

    错误一:Error Message:未能找到存储过程 'master..xp_cmdshell'. 第一步先删除:drop procedure sp_addextendedprocdrop proce ...

  6. Rsync常见错误和问题

    五.常见问题 以下是为配置rsync时的常见问题: 问题一:@ERROR: chroot failedrsync error: error starting client-server protoco ...

  7. spring错误汇总

    在学习spring过程中遇见了种种不同的异常错误,这里做了一下总结.希望遇见类似错误的同学们共勉一下. 1. 错误一 Error creating bean with name 'helloServi ...

  8. webapi权限常见错误

    webapi权限常见错误 错误一: Response for preflight has invalid HTTP status code 405. 解决方案: 屏蔽配置文件中的如下代码 <!- ...

  9. ubuntu或者debian安装php-gd扩展错误

    ‘./configure’ ‘–prefix=/usr/local/php’ ‘–with-config-file-path=/etc’ ‘–with-mysql=/usr/local/mysql’ ...

随机推荐

  1. python基础教程_学习笔记10:异常

    异常 什么是异常 Python用异常对象来表示异常情况.遇到错误后,会引发异常.假设异常对象并未被处理或捕捉,程序就会用所谓的回溯(Traceback,一种错误信息)终止运行: >>> ...

  2. csdn肿么了,这两天写的博文都是待审核

    昨天早上8点写了一篇博文,然后点击发表,结果系统显示"待审核".于是仅仅好qq联系csdn的客服,等到9点时候,csdn的客服上线了,然后回复说是链接达到5个以上须要审核,于是回到 ...

  3. 【VBA研究】查找目录以下全部文件的名称

    作者:iamlaosong 目录里面保存有面单扫描的图像文件,文件名称为邮件号码.如今想收集这些邮件号码,由于量非常大,不可能一个一个的截取,仅仅能通过程序实现.假定,当前工作表B列里放的是存放这些图 ...

  4. Codeforces 461B - Appleman and Tree 树状DP

    一棵树上有K个黑色节点,剩余节点都为白色,将其划分成K个子树,使得每棵树上都仅仅有1个黑色节点,共同拥有多少种划分方案. 个人感觉这题比較难. 如果dp(i,0..1)代表的是以i为根节点的子树种有0 ...

  5. android 屏幕适配 课程笔记

    1 横竖屏切换:   文件名同样.  目录不同.   layout-port/ 代表竖屏   layout-land/ 代表横屏   layout/ 代表不论什么没有修饰符的layout目录.   终 ...

  6. hdu3602(变形背包)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3602 题意是:N个国家,M个飞船,每个国家有人数num,如果上飞船就给联合国value钱,选出某些国家 ...

  7. 画师绘制《进击的巨人》电影版海报 堪比好莱坞- Micro Reading

    http://m.baidu.com/from=844b/bd_page_type=1/ssid=0/uid=3151E6C0905477A13653132D762BB6FB/pu=sz%401320 ...

  8. 金融界高富帥現身快男北京唱區 陳樂:我拿生活養夢想__娛樂新聞_Yes娛樂

    http://m.baidu.com/tc?pn=15&bd_page_type=1&pu=sz%401320%5F1001%2Cta%40iphone%5F2%5F4%2E1%5F3 ...

  9. sql大小转换函数

    将字段值转换成大写 UPDATE t SET [name]=UPPER([name]) 将字段值转换成小写 UPDATE t SET [name]=LOWER([name])

  10. Android画图监听接口OnPreDrawListener具体解释

    public static interface ViewTreeObserver.OnPreDrawListener 我们先看下API中的定义: 类概述: 为即将绘制视图树时运行的回调函数定义的接口. ...