26
I have a Thymeleaf template code to format a date. There are times when that date will be null in the returned object. What is the best way to check for null in Thymeleaf in this situation? Currently the template is throwing the following error:
Caused by: java.lang.IllegalArgumentException: Cannot apply format on null
at org.thymeleaf.util.Validate.notNull(Validate.java:37)
at org.thymeleaf.util.DateUtils.format(DateUtils.java:182)
at org.thymeleaf.expression.Dates.format(Dates.java:164)