当前位置:网站首页>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
边栏推荐
- Chlamydia infection -- causes, symptoms, treatment and Prevention
- Summary of knowledge map (3)
- Xiaomi, which has set the highest sales record of domestic mobile phones in overseas markets, paid renewed attention to the domestic market
- 【BIM+GIS】ArcGIS Pro2.8如何打开Revit模型,BIM和GIS融合?
- QT program integration easyplayer RTSP streaming media player screen flicker what is the reason?
- TreeSet课后练习
- Understand the gut organ axis, good gut and good health
- Single chip microcomputer serial port data processing (2) -- ucosiii + cyclic queue receiving data
- 【Pytorch基础】torch.split()用法
- The whole process of connecting the newly created unbutu system virtual machine with xshell and xftp
猜你喜欢

Xiaohongshu was exposed to layoffs of 20% as a whole, and the internal volume among large factories was also very serious

Express middleware ① (use of Middleware)

Bacterial infection and antibiotic use

Unipolar NRZ code, bipolar NRZ code, 2ASK, 2FSK, 2PSK, 2DPSK and MATLAB simulation

Nature medicine reveals individual risk factors of coronary artery disease

Thought of reducing Governance -- detailed summary of binary search

C语言:恶搞小游戏

【BIM入门实战】Revit中的墙体层次以及常见问题解答

Overview of knowledge map (II)

【论文阅读】【3d目标检测】Voxel Transformer for 3D Object Detection
随机推荐
从MySQL数据库迁移到AWS DynamoDB
MATLAB lit plusieurs diagrammes fig et les combine en un seul diagramme (sous forme de sous - Diagramme)
使用大华设备开发行AI人流量统计出现时间不正确的原因分析
记录一下盲注脚本
【论文阅读】【3d目标检测】Improving 3D Object Detection with Channel-wise Transformer
STM32 MCU ADC rule group multi-channel conversion DMA mode
OpenCV----YOLACT实例分割模型推理
UDP protocol and TCP protocol
IEEE Transactions on Systems, Man, and Cybernetics: Systems(TSMC)投稿须知
[AI vision · quick review of today's sound acoustic papers issue 1] Thu, 14 APR 2022
Unipolar NRZ code, bipolar NRZ code, 2ASK, 2FSK, 2PSK, 2DPSK and MATLAB simulation
[latex] formula group
[echart] Introduction to echart
[mapping program design] coordinate inverse artifact v1 0 (with C / C / VB source program)
【李宏毅2022 机器学习春】hw6_GAN(不懂..)
Does China Mobile earn 285 million a day? In fact, 5g is difficult to bring more profits, so where is the money?
Xshell、Xftp连接新创建的Unbutu系统虚拟机全流程
Qt程序集成EasyPlayer-RTSP流媒体播放器出现画面闪烁是什么原因?
Summary of knowledge map (3)
What is software acceptance testing? What are the benefits of acceptance testing conducted by third-party software testing institutions?