If I have a rythm template such as the following,
@{
String name = null;
}
Name : @name
I would like to render null in the template. Instead, it renders it as a blank string.
Expected : Name : null
Actual : Name :
Looks like elvis expressions are one way to achieve this
Name : @(name ?: "null")
Is there a better way to make Rythm render null when the object value is null ?
No, the template engine treat
nullas blank string. If you need to display the literalnull, stick to your method, i.e.@(name ?: "null")