Using Thymeleaf when the value is null

后端 未结 10 1879
傲寒
傲寒 2020-11-29 21:01

I have some values in my database which can be null if they have not already been entered.

But when I use Thymeleaf in my html, it gives an error when parsing null v

10条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 21:30

    This can also be handled using the elvis operator ?: which will add a default value when the field is null:

    
    

提交回复
热议问题