当前位置:网站首页>98. Error s.e.errormvcautoconfiguration $staticview reported by freemaker framework: cannot render error page for request
98. Error s.e.errormvcautoconfiguration $staticview reported by freemaker framework: cannot render error page for request
2022-04-23 12:40:00 【Thomas kutao】
Error message
2022-04-22 12:59:38.904 ERROR 16164 --- [nio-8888-exec-1] freemarker.runtime : Error executing FreeMarker template
freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> pageContext [in template "courseAdd.html" at line 84, column 29]----
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<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
--------
FTL stack trace ("~" means nesting-related):
- Failed at: ${pageContext.request.contextPath} [in template "courseAdd.html" at line 84, column 27]
----
Back end code
The front-end code
Its function is to realize the drop-down box , Added option But it doesn't show ( Here's the picture ), And the back-end data has been obtained ( It's printed on the console ), I thought I couldn't get data from the front-end .
Look back and report the wrong information , Find out
o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
The general meaning is :Servlet Request processing failed , May be null or missing
Problem analysis
That should be the problem of null value , As a result, the drop-down box cannot be displayed normally ,teacherNames There is a null value in
Log The treatment method is given, that is ( Red and bold tips above ) add to
<div class="layui-input-block">
<!-- <#if myOptionalVar??>when-present<#else>when-missing</#if>-->
<select id="baseCourseSelect" lay-search>
<option>-- Please select ——</option>
<#list teacherNames as tname>
<option value="${tname}">${tname}</option>
</#list>
</select>
</div>
Later, the final solution was found by searching :
Problem solving
In the configuration item (application.yml) Add the setting of global de null value in :
spring.freemarker.settings.classic_compatible= true
Be careful true There is a space in front , Otherwise it won't work .
Final effect
版权声明
本文为[Thomas kutao]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231153217480.html
边栏推荐
猜你喜欢
Everything can be expected in the future | one 2022 campus recruitment officially opened
一个平面设计师的异想世界|ONES 人物
Unlock openharmony technology day! The annual event is about to open!
实现一个盒子在父盒子中水平垂直居中的几种“姿势”
Pre competition practice of TIANTI competition
消息队列概述
QT interprocess communication
Recommended programming AIDS: picture tool snipaste
Intelligent multi line elastic cloud adds independent IP address. How to realize multi line function?
Number of nodes of complete binary tree
随机推荐
Zero trust in network information security
一个平面设计师的异想世界|ONES 人物
Zigbee之CC2530最小系统及寄存器配置(1)
STM32控制步进电机(ULN2003+28byj)
Redis deployment of cloud native kubesphere
甲辰篇 創世紀《「內元宇宙」聯載》
The maximum number of remote desktop servers has been exceeded
BUUCTF WEB [BUUCTF 2018]Online Tool
NPDP|产品经理如何做到不会被程序员排斥?
Can I take the CPDA data analyst certificate for 0 foundation
云原生KubeSphere部署Redis
传统企业如何应对数字化转型?这些书给你答案
SQLserver怎么插入或更新当天的星期数,bit而不是文本
Analysis of InnoDB execution process in MySQL
How to switch PHP version in Windows 2008 system
Markdown语法学习
SSL certificate refund instructions
QT one process runs another
Stm32cubeprogrammer basic instructions
Aviation core technology sharing | overview of safety characteristics of acm32 MCU