Thymeleaf: check if a variable is defined

后端 未结 4 1703
不思量自难忘°
不思量自难忘° 2020-12-24 05:45

How can I check if a variable is defined in Thymeleaf?

Something like this in Javascript:

if (typeof variable !== \         


        
4条回答
  •  庸人自扰
    2020-12-24 06:47

    You can use conditional operators. This will write variable if exists or empty string:

提交回复
热议问题