Handling null values in Freemarker

前端 未结 5 2083
时光说笑
时光说笑 2020-12-07 22:19

How to handle null values in Freemarker? I get some exceptions in the template when null values are present in data.

5条回答
  •  一整个雨季
    2020-12-07 23:06

    If you have a lot of variables to convert in optional, you can use SubimeText with this:

    Find: \${([A-Za-z_0-9]*)}
    Replace: \$\{${1}!\}
    

    Be sure regex and case-sensitive options are enabled:

提交回复
热议问题