For example. String s can have these values like "value", "" or null.
<#if str?? && str?has_content>
${str}
</#if>
Can I check ??(null) and ?has_content(empty not null) both value in freemarker if statement not using TemplateModel?
str?has_content
returns true
if str
is non-null
(non-missing), and is also not a 0-length string. So you just need <#if str?has_content>
.
(As of TemplateModel
-s, every value is a TemplateModel
as far as templates see. There's no such thing as a non-TemplateModel
value.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With