freemarker报错:Tip: If the failing expression is known to be legally null/missing, either specify a de

手机刷双系统 刷机教程(https://www.geekeyes.cn/forum.php/forum.php?mod=viewthread&tid=492) 解锁教程(http://www.gioov.com/index.php/1386)   解锁教程 cmd下 进入adb目录( 如果环境变量配置了adb 可以直接在cmd 下输入命令) 手机连接电脑,确保usb 调试打开,然后手机连接电脑,... 阅读详情
AI摘要

本文介绍Freemarker模板引擎中如何正确处理空值和未定义变量的问题,避免运行时报错,并提供了一种推荐的写法。

freemarker报错:Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??



大致意思是所写的表达式应判定不为空或者指定一个默认值,貌似ftl的<#if>判断一般都一定要判断一下不能为空

错误写法(后台会报错,实际上可以允许):

</pre><p><pre name="code" class="html"><span style="font-size:18px;"><#if lists?? && lists?size gt 0>
<#list lists as list>
<option value="${list.id}" <#if outbean.id == '${list.id}'> selected="selected" </#if> >${list.name!''}</option>
</#list>
</#if></span>

纠正写法:

<#if lists?? && lists?size gt 0>
<#list lists as list>
<option value="${list.id}" <#if (outbean.id!'') == '${list.id}'> selected="selected" </#if> >${list.name!''}</option>
</#list>
</#if>


[Godot][入门] 安装与版本选择:3.x 还是 4.x?(按项目类型一键决策) 摘要: Godot引擎版本选择需根据项目需求权衡3.x与4.x。Godot4.x(如4.2)适合3D开发和新项目,支持Vulkan和GDScript2.0,但生态尚不成熟;Godot3.x(如3.5.3)则更适合稳定2D开发、Web导出及依赖现有插件/教程的场景。安装方式极简,官网下载解压即可运行。新手建议:短期高效选3.x,长期探索选4.x,旧项目勿盲目迁移。附版本对比表及决策树,助开发者快速匹配需求。 阅读详情

相关推荐

工控安全政策系列导读:国际标准IEC 62443标准系列

IEC 62443由ANSI/ISA提出,被ISO/IEC采纳,所以该标准会以不同的名字出现,包括:ANSI/ISA-99,ISA-99,ISA 62443,ISO/IEC 62443,ISO 62443,IEC 62443。其中IEC 62443-2-1已等同采纳为国标,于2016年10月发布,标准编号为GB/T 33007。 IEC 62443是在国...

weixin_34132768的博客 2623

解决方法整合-----The following has evaluated to null or missing

问题描述 servlet请求转发到freemarker中,访问时报错如下 Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#els

doublepg13的博客 7465

发那科FOCAS 1/2文档——核心库文件

在开始开发前,明确目标 CNC 的具体型号、连接方式(HSSB/TCP/IP)、软件版本和配置(如轴数、程序号位数),并据此正确配置开发环境和编译选项。开发时需要包含相应的头文件。这是开发跨平台应用时需要特别注意的地方。这是开发应用时必须了解的核心文件。

snailiot的博客 1021

FreeMarker空值异常:

freemarker 报错: username:'FreeMarker template error (DEBUG mode; use RETHROW in production!): The following has evaluated to null or missing: ==> profile [in template “inc/layout.ftl” at line 28, column 21] Tip: If the failing expression is known to leg

weixin_43270731的博客 1万+

python 爬取携程全国旅游景点信息-2024.4.13

携程网是中国领先的在线旅行服务公司,提供酒店预订、机票预订、旅游度假、商旅管理等服务。携程网上有大量的旅游景点和酒店信息,这些信息对于旅行者和旅游业者都有很大的价值。通过爬虫技术,我们可以从携程网上获取这些信息,并进行数据清洗、数据分析、数据可视化等操作,从而得到有用的洞察和建议。

britlee的博客 1万+

8-阿里云服务器 ECS配置R及Studio Server

步骤概览:(首先要明确自己的系统然后进行安装)

hx2024的博客 1572

SpringCloud 微服务注册中心启动之后报错,如何处理!

Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either s...

xhalg的专栏 1753

27、超声成像技术与原理全面解析

本博客全面解析了超声成像技术与原理,涵盖声学材料特性、超声成像系统的基本概念与组成、关键技术如多普勒和聚焦技术、超声换能器的设计与原理、图像处理方法、系统校准与质量控制,以及超声成像的应用领域和发展趋势。旨在为医学诊断、工业检测和海洋声学等领域的研究人员和工程师提供深入的技术参考和指导。

z2a3b4c5d的博客 496

配置springCloud犯了个特别低级的错误

问题如下 FreeMarker template error (DEBUG mode; use RETHROW in production!): The following has evaluated to null or missing: ==> replica.key [in template "eureka/navbar.ftlh" at line 68, column 62] ---- Tip: It's the step after the last dot that caused this

佐杰的博客 945

Autosar配置——导入DBC后配置SecOC同步报文和同步请求报文

在Autosar中,安全性是一个重要的考虑因素,而SecOC(Secure On-Board Communication)是一种用于保护通信数据完整性和安全性的安全机制。在上述示例中,我们配置了同步报文和同步请求报文的属性。接下来,我们需要在Autosar中配置同步报文和同步请求报文。同步报文用于在通信双方之间同步SecOC状态,而同步请求报文用于请求SecOC的状态信息。通过以上配置,我们成功地导入了DBC文件,并在Autosar系统中配置了SecOC同步报文和同步请求报文。希望以上信息对您有所帮助!

CyberSphinx的博客 649

ctle电路求帮忙分析低中高频调节原理,搭好了电路该怎样调节参数?

🏆本文收录于专栏,主要记录项目实战过程中所遇到的Bug或因后果及提供真实有效的解决方案,希望能够助你一臂之力,帮你早日登顶实现财富自由🚀;同时,欢迎大家!持续更新中,up!up!up!!

**My Coding Family** 1129

解决---freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:Tip:

这个是在搭建cloud+boot…+mybatis…+freemarker.模板 报错的错 这个错 说的是找不到 或者空数据 freemarker.core.InvalidReferenceException: The following has evaluated to null or missing: ==> user [in template "user.ftl" at line ...

T 1万+

基于Gurobi的综合能源系统运行优化:鲁棒两阶段优化方法

本文提出了一种基于Gurobi的综合能源系统鲁棒两阶段优化方法,针对包含换电站、光伏发电和电池储能的系统运行问题。研究采用多面体不确定性集合描述光伏出力随机性,构建了考虑电池衰减成本和弃光惩罚的两阶段优化模型:第一阶段制定日前调度计划,第二阶段处理实时运行中的不确定性。通过列与约束生成算法求解模型,并使用Python和Gurobi实现。仿真验证了该方法能有效平衡系统经济性与鲁棒性,为含高比例可再生能源的综合能源系统运行提供了实用解决方案。

huanghm88的专栏 242

springboot整合freemarker出现空指针异常的解决办法

问题 ERROR 792 --- [nio-8080-exec-2] freemarker.runtime : Error executing FreeMarker template freemarker.core.InvalidReferenceException: The following has evaluated to null or mis...

玫瑰与鹿° 5046

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

SpringBoot报错(十一)freemarket报错 freemarker.runtime : Error executing FreeMarker t

2017-12-25 10:49:26.530 ERROR 13156 --- [p-nio-88-exec-1] freemarker.runtime : Error executing FreeMarker template freemarker.core.InvalidReferenceException: The following has ...

Jiunn-Nan的博客 2万+

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

Freemarker无法获取对象属性,报错The following has evaluated to null or missing (实体类的属性命名不规范导致)

最近写freemarker项目的时候遇到一个错The following has evaluated to null or missing,改了一个上午才改好,下特意写下,以此为鉴! 歌曲实体类(问题就出在这!!!!!!!!) import java.io.Serializable; public class Music implements Serializable{ private Stri...

nuoyan2018的博客 4万+

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Caused by: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing

仅在FTL文件中 IDEA控制台这样:Tip: If the failing expression is known to be legally refer to something that’s sometimes null or missing, either specify a default value like myOptionalVar! 错误又是:Caused by: freemarker.core.InvalidReferenceException: The following has ev

GodGump的博客 4199

java7课程,Java技术【7天课程免费学习】-互动吧

FreeMarker template error:The following has evaluated to null or missing:==> pb.detail_after [in template "web_pc/detail/party.ftl" at line 16, column 9]Tip: If the failing expression is known to ...

weixin_39860123的博客 136

BUG——Freemarker:The following has evaluated to null or missing

一、异常 FreeMarker template error: The following has evaluated to null or missing: ==> goodsDesc [in template "item.ftl" at line 428, column 75] ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missin

Today_He的博客 5932

freemarker生成html字符串,Freemarker生成HTML错误

错误代码:0 ERROR [main] freemarker.runtime --Error executing FreeMarker template 03 七月 2015 14:25:32,730FreeMarker template error:The following has evaluated to null o...

weixin_33560311的博客 934

解决字符串替换报错的问题

问题: The following has evaluated to null or missing:\n==> url [in template \"template\" at line 1, column 3]\n\n----\nTip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default valu

zheng2780071070的博客 1370

freemarker空值报错学习

freemarker 错误修改freemarker模板出现空指针错误ftl对应代码解决方法 freemarker模板出现空指针错误 when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??

weixin_46282128的博客 1394

freemark空值报错

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34375054的博客 584

debug|freemarker的InvalidReferenceException处理

读了读下面的报错,基本上明白错误的地方了:就是我用于生成模板的数据,有些是空字段,而这个我并没有设置,因此模板引擎报错了。知道这个错误后事情就简单了,要么设置空字段默认值,要么传入的值不能为空即可。好的,百度一下这个异常咋回事,一搜,说是模板里面的放的值不能为空,好家伙,不能为空啊,那读读报的错是不是这个意思呢?密密麻麻的,真让人头疼,先检查下环境配的对不对好了,xml配置、模板地址啥的,检查后发现没问题,那进入到第二步,检查下具体异常是啥;首先找下抛出的异常是啥,

weixin_48118167的博客 2033

mybatis-plus生成代码失败

生成报错 FreeMarker template error: The following has evaluated to null or missing: ==> table.comment [in template “templates/entity.java.ftl” at line 19, column 6] Tip: It’s the step after the last dot that caused this error, not those before it. Tip: If

zgp11_2018的博客 3604

SpringCloud Eureka 启动时访问报错了freemarker.core.InvalidReferenceException: The following has evaluated to

控制台异常代码: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing: ==> replica.key [in template "eureka/navbar.ftlh" at line 68, column 62] ---- Tip: It's the st...

柠檬味拥抱的博客 2066
上一篇: mybatis的sql注入问题
下一篇: SpringMVC + Spring + MyBatis 学习笔记:提交数据遭遇日期格式转化报400错误解决方法
Java_Mr_Zheng
博客等级 码龄11年 18粉丝 20原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值