You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by Apache Wiki <wi...@apache.org> on 2012/12/11 15:51:05 UTC

[Velocity Wiki] Update of "CheckingForNull" by DavidMiller

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" == "" )
  }}}