当前位置:网站首页>thymeleaf th:value 为null时报错问题
thymeleaf th:value 为null时报错问题
2022-04-23 04:18:00 【猎人在吃肉】
通常,thymeleaf 显示值的方式:
<input type="text" class="form-control" th:value="${userDO.name}">
但是,当对象userDO 为空,或者 对象的属性name 为空时,会报错。
可以优化为如下:
<input type="text" class="form-control" th:value="${userDO?.name}">
如果是多层对象嵌套,可以如下写法:
<input type="text" class="form-control" th:value="${userDO?.name?.lastName}">
版权声明
本文为[猎人在吃肉]所创,转载请带上原文链接,感谢
https://xiaojin21cen.blog.csdn.net/article/details/120864301
边栏推荐
- Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
- 【论文阅读】【3d目标检测】point transformer
- Win10 boot VMware virtual machine boot seconds blue screen problem perfect solution
- Express中间件①(中间件的使用)
- Bacterial infection and antibiotic use
- HMS Core Discovery第14期回顾长文|纵享丝滑剪辑,释放视频创作力
- STM32F4单片机ADC采样及ARM-DSP库的FFT
- 【BIM+GIS】ArcGIS Pro2.8如何打开Revit模型,BIM和GIS融合?
- Leetcode->1 两数之和
- 【Pytorch基础】torch.split()用法
猜你喜欢
Difference between LabVIEW small end sequence and large end sequence
作为一名码农,女友比自己更能码是一种什么体验?
Does China Mobile earn 285 million a day? In fact, 5g is difficult to bring more profits, so where is the money?
单片机串口数据处理(2)——uCOSIII+循环队列接收数据
兼容NSR20F30NXT5G的小体积肖特基二极管
洛谷P1858 【多人背包】 (背包求前k优解)
Stm32f4 MCU ADC sampling and FFT of ARM-DSP Library
Matlab minimalist configuration of vscode configuration
Retrieval question answering system baseline
【NeurIPS 2019】Self-Supervised Deep Learning on Point Clouds by Reconstructing Space
随机推荐
UDP protocol and TCP protocol
C语言常用字符串处理函数
Chlamydia infection -- causes, symptoms, treatment and Prevention
记录一下盲注脚本
上海航芯技术分享 | ACM32 MCU安全特性概述
[AI vision · quick review of robot papers today, issue 29] Mon, 14 Feb 2022
Nel ASA: her ø Ya facility in Norway officially opened
Express中间件②(中间件的分类)
A new method for evaluating the quality of metagenome assembly - magista
matlab读取多张fig图然后合并为一张图(子图的形式)
QtSpim手册-中文翻译
【时序】基于 TCN 的用于序列建模的通用卷积和循环网络的经验评估
Zotero6. Version 0 quicklook cannot be used / Chinese garbled code will not be displayed
matlab讀取多張fig圖然後合並為一張圖(子圖的形式)
【论文阅读】【3d目标检测】point transformer
STM32F4单片机ADC采样及ARM-DSP库的FFT
Common string processing functions in C language
Cortex-M3寄存器组、汇编语言与C语言的接口介绍
[BIM introduction practice] Revit building wall: detailed picture and text explanation of structure, envelope and lamination
OpenCV----YOLACT实例分割模型推理