Reputation: 657
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
?
Upvotes: 0
Views: 68
Reputation: 14373
No, the template engine treat null
as blank string. If you need to display the literal null
, stick to your method, i.e. @(name ?: "null")
Upvotes: 0