$null check in velocity

前端 未结 1 998
野性不改
野性不改 2020-12-16 09:24

I came to know about null check using $null in velocity 1.6 through a resource updated by you. Resource: Reading model objects mapped in Velocity Templates But I am facing s

相关标签:
1条回答
  • 2020-12-16 09:53

    To check if a variable is not null simply use #if ($variable)

    #if ($variable) 
     ... do stuff here if the variable is not null
    #end
    

    If you need to do stuff if the variable is null simply negate the test

    #if (!$variable)
     ... do stuff here if the variable is null
    #end
    
    0 讨论(0)
提交回复
热议问题