Dear Wiki user, You have subscribed to a wiki page or wiki category on "Velocity Wiki" for change notification.
The "CheckingForNull" page has been changed by DavidMiller: http://wiki.apache.org/velocity/CheckingForNull?action=diff&rev1=3&rev2=4 Comment: Updated links [[http://issues.apache.org/bugzilla/show_bug.cgi?id=27741|Bugzilla #27741]], VelocityNullSupport. - '''''Approach 1:''''' Use the fact that null is evaluated as a false conditional. (cf. http://jakarta.apache.org/velocity/user-guide.html#Conditionals) + '''''Approach 1:''''' Use the fact that null is evaluated as a false conditional. (cf. http://velocity.apache.org/engine/devel/user-guide.html#Conditionals) {{{ #if( ! $car.fuel ) }}} ''Note:'' The conditional will also pass if the result of $car.fuel is the boolean false. What this approach is actually checking is whether the reference is '''null or false'''. - '''''Approach 2:''''' Use the fact that null is evaluated as an empty string in quiet references. (cf. http://jakarta.apache.org/velocity/user-guide.html#Quiet%20Reference%20Notation) + '''''Approach 2:''''' Use the fact that null is evaluated as an empty string in quiet references. (cf. http://velocity.apache.org/engine/devel/user-guide.html#quietreferencenotation) {{{ #if( "$!car.fuel" == "" ) }}}
