Spring Boot项目使用了Freemarker模板引擎。

在ftl文件中使用了一些变量,但是一直出现错误,无法正常渲染页面,反复出现的报错是:

freemarker.core.NonNumericalException: For "#{...}" content: Expected a number, but this has evaluated to a string (wrapper: f.t.SimpleScalar):

而我使用那些变量时本来就是要string类型的,报错信息却说“Expected a number”。

最后发现错误是,应该要使用 ${…},而不是 #{…} 

因为这个东西搞了一下午,记下来提醒自己。

Freemarker出现NullNumberException异常的更多相关文章

  1. freemarker springmvc配置异常

    异常信息 java.lang.IllegalAccessError: tried to access method freemarker.ext.servlet.AllHttpScopesHashMo ...

  2. freemarker中的null异常处理以及!与??的使用(转)

    原文链接: https://blog.csdn.net/mexican_jacky/article/details/50638062 阅读数:6304 如工程包含: 在user中我们有个角色,那么我们 ...

  3. freeMarker(九)——程序开发指南补充知识

    学习笔记,选自freeMarker中文文档,译自 Email: ddekany at users.sourceforge.net 1.变量.范围 本章介绍当模板在访问变量时发生了什么事情,还有变量是如 ...

  4. freeMarker(八)——程序开发指南之配置(Configuration)

    学习笔记,选自freeMarker中文文档,译自 Email: ddekany at users.sourceforge.net 1.基本内容 配置(configuration)就是 freemark ...

  5. spring boot 异常处理(转)

    spring boot在异常的处理中,默认实现了一个EmbeddedServletContainerCustomizer并定义了一个错误页面到"/error"中,在ErrorMvc ...

  6. MyBatisPlus代码生成 mvc项目

    package com.test; import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus ...

  7. cosbench 异常 FreeMarker template error: The following has evaluated to null or missing

    问题现象: 使用Cosbench 0.4.2.c4 版本测试Ceph RGW read test失败,遇到异常如下: FreeMarker template error: The following ...

  8. 当freemarker中EL表达式的值为空时出现异常的解决方法

     <#list pageView.list as msg>      <form name="msgForm" id="msgForm" ...

  9. freemarker null异常详解及兼容模式

    在读取user的时候,因为为空,报错了,错误处的代码是这样的 <#if user> 其实准确的写法应该是 <#if user??> 如果要消除错误,需要把前端代码修后成后面这种 ...

随机推荐

  1. Spring Cloud实践之服务注册与发现Eureka

    一.简述: 服务提供者producer与服务消费者consumer都注册到eureka server,然后服务consumer在其应用内直接调用producer的服务名来调用服务,而不是像之前一样调用 ...

  2. [vuejs] vue2.0-layer-mobile移动端弹层

    vue2.0-layer-mobile移动端弹层 本次组件升级支持slot内容分发功能,实现高定制内容风格的弹层 安装方法 npm install vue2-layer-mobile -S 初始化 i ...

  3. Unable to preventDefault inside passive event listener due to target being treated as passive?

    使用滚动时候,新版google浏览器,会弹出如下的警告. 解决方法,可以加上* { touch-action: none; } 这句样式去掉. 其原因:https://developers.googl ...

  4. activemq在一台服务器上启动多个Broker

    步骤如下: 1.把整个conf文件夹复制一份,比如叫conf2 2.修改里面的activemq.xml文件 ①brokerName不能和原来的重复 ②数据存放的文件名称不能重复,比如<kahaD ...

  5. vue教程2-08 自定义键盘信息、监听数据变化vm.$watch

    vue教程2-08 自定义键盘信息 @keydown.up @keydown.enter @keydown.a/b/c.... 自定义键盘信息: Vue.directive('on').keyCode ...

  6. Python中的 // 与 / 的区别

    " / " 表示浮点数除法,返回浮点结果;" // " 表示整数除法,返回不大于结果的一个最大的整数 [code] print("6 // 4 = & ...

  7. (转)每天一个linux命令(21):find命令之xargs

    原文:http://www.cnblogs.com/peida/archive/2012/11/15/2770888.html https://blog.csdn.net/ly1358152944/a ...

  8. 全网最详细的再次或多次格式化导致namenode的ClusterID和datanode的ClusterID之间不一致的问题解决办法(图文详解)

    不多说,直接上干货! java.io.IOException: Incompatible clusterIDs in /opt/modules/hadoop-2.6.0/data/tmp/dfs/da ...

  9. 使用java调用fastDFS客户端进行静态资源文件上传

    一.背景 上篇博客我介绍了FastDFS的概念.原理以及安装步骤,这篇文章我们来聊一聊如何在java中使用FastDFSClient进行静态资源的上传. 二.使用步骤 1.开发环境 spring+sp ...

  10. JVM Scan

    1.jmap -histo pid|head -100 2.jstat -gcutil pid cycle 3.jmap -heap pid