1、错误描述

六月 04, 2014 10:31:47 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error
严重: Template processing error: "Expected number, sequence, or string. maps evaluated instead to freemarker.core.HashLiteral$SequenceHash on line 11, column 12 in map.ftl."

Expected number, sequence, or string. maps evaluated instead to freemarker.core.HashLiteral$SequenceHash on line 11, column 12 in map.ftl.
The problematic instruction:
----------
==> ${maps[3]} [on line 11, column 10 in map.ftl]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateException: Expected number, sequence, or string. maps evaluated instead to freemarker.core.HashLiteral$SequenceHash on line 11, column 12 in map.ftl.
	at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:136)
	at freemarker.core.DynamicKeyName.dealWithNumericalKey(DynamicKeyName.java:125)
	at freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:90)
	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:210)
	at com.you.test.freemarker.FreemarkerTest.testMap(FreemarkerTest.java:197)
	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)

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>freemarker</title>

  </head>

  <body>

Expected number, sequence, or string. maps evaluated instead to freemarker.core.HashLiteral$SequenceHash on line 11, column 12 in map.ftl.
The problematic instruction:
----------
==> ${maps[3]} [on line 11, column 10 in map.ftl]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateException: Expected number, sequence, or string. maps evaluated instead to freemarker.core.HashLiteral$SequenceHash on line 11, column 12 in map.ftl.
	at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:136)
	at freemarker.core.DynamicKeyName.dealWithNumericalKey(DynamicKeyName.java:125)
	at freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:90)
	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:210)
	at com.you.test.freemarker.FreemarkerTest.testMap(FreemarkerTest.java:197)
	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 number, sequence, or string. maps evaluated instead to freemarker.core.HashLiteral$SequenceHash on line 11, column 12 in map.ftl.
The problematic instruction:
----------
==> ${maps[3]} [on line 11, column 10 in map.ftl]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateException: Expected number, sequence, or string. maps evaluated instead to freemarker.core.HashLiteral$SequenceHash on line 11, column 12 in map.ftl.
	at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:136)
	at freemarker.core.DynamicKeyName.dealWithNumericalKey(DynamicKeyName.java:125)
	at freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:90)
	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:210)
	at com.you.test.freemarker.FreemarkerTest.testMap(FreemarkerTest.java:197)
	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)

2、错误原因

<#--freemarker HashMap取值-->
<#assign maps={"1":"张三丰","2":"李思思","3":"张三强","4":"王五"}/>
${maps[3]}

map取值时是要取序列、数字、字符串

3、解决办法

${maps["3"]}

freemarker报错之十二的更多相关文章

  1. freemarker报错之十五

    1.错误描述 六月 04, 2014 11:04:03 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template proc ...

  2. freemarker报错之十四

    1.错误描述 <html> <head> <meta http-equiv="content-type" content="text/htm ...

  3. freemarker报错之十

    1.错误描述 <html> <head> <meta http-equiv="content-type" content="text/htm ...

  4. freemarker报错之四

    1.错误描述 五月 28, 2014 9:56:48 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template proce ...

  5. freemarker报错之七

    1.错误描述 五月 30, 2014 11:33:57 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template proc ...

  6. 关于SpringMVC整合freemarker报错问题

    错误信息: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FreeMa ...

  7. Android8 以上使用 UIautomator Viewer提示Unexpected error while obtaining UI hierarchy报错(方法二)

    一:最常见的一个问题就是:Android8及以上的系统无法获取到页面,提示报下面的错误 二:解决办法 1.下载新的tools,在下面链接里找到SDK tools下载 http://www.androi ...

  8. freemarker报错之二

    1.错误描述 五月 27, 2014 12:07:05 上午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template proc ...

  9. freemarker写select组件报错总结(二)

    1.错误描述 六月 25, 2014 11:32:49 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template proc ...

随机推荐

  1. 07_SSH免登录配置

    占位占位占位占位占位占位占位占位

  2. POJ [P2631] Roads in the North

    树的直径 树的直径求法: 任取一点u,找到树上距u最远的点s 找到树上距s点最远的点t,s->t的距离即为所求 #include <iostream> #include <cs ...

  3. python用Django+Celery+Redis 监视程序(一)

    C盘创建一个目录就叫DjangoDemo,然后开始在该目录下操作. 1.新建Django工程与应用 运行pip install django 安装django 这里我们建一个名为demo的项目和hom ...

  4. Windows Server 2016-图形化迁移FSMO角色

    上章节我们简单介绍了三种不同方式查看FSMO主机角色信息,在开篇之前我们简单回顾一下FSMO五种操作主机角色:林范围操作主机角色有两种,分别是 架构主机角色(Schema Master)和 域命名主机 ...

  5. 关于http与https之间的区别

    年前的时候进行了一家公司的电话面试两轮,视频面试一轮(已拿到offer),过程中遇到了一个关于http与https的问题,当时回答的并不好,今天将其进行了总结和整理,望读者喜欢: 前言 谷歌在2018 ...

  6. 多路复用select

    多路复用I/O:一个执行体监视多个文件描述符对象的状态是否改变,一旦改变通知其他执行体来实现. 基本思想: 1. 先构造一张有关描述符的表,然后调用一个函数,当这些文件描述符中的一个或者多个已准备好进 ...

  7. CentOS下安装go语言编译环境

    1.下载Go语言的安装包 这里给大家一个百度的分享连接http://pan.baidu.com/s/1qY3xPaG下载到CentOS的系统之中 $ tar -xzf go1.5.2.linux-xx ...

  8. angularjs 指令详解

    一.指令定义 对于指令,可以把它简单的理解成在特定DOM元素上运行的函数,指令可以扩展这个元素的功能. 首先来看个完整的参数示例再来详细的介绍各个参数的作用及用法: <div my-direct ...

  9. OpenCV角点检测goodFeaturesToTrack()源代码分析

    上面一篇博客分析了HARRIS和ShiTomasi角点检测的源代码.而为了提取更准确的角点,OpenCV中提供了goodFeaturesToTrack()这个API函数,来获取更加准确的角点位置.这篇 ...

  10. Java基础系列--static关键字

    原创作品,可以转载,但是请标注出处地址:http://www.cnblogs.com/V1haoge/p/8477914.html 一.概述 static关键字是Java诸多关键字中较常使用的一个,从 ...