How to handle null values in Freemarker? I get some exceptions in the template when null values are present in data.
Use ?? operator at the end of your <#if> statement.
This example demonstrates how to handle null values for two lists in a Freemaker template.
List of cars:
<#if cars??>
<#list cars as car>${car.owner};#list>
#if>
List of motocycles:
<#if motocycles??>
<#list motocycles as motocycle>${motocycle.owner};#list>
#if>