The original
#if ($mobile)This is not an accurate notation, please replace it with
"$! {
Mobile
}"!=""
Description:
#if ($mobile)This notation
can only work on nullOther words
#if ($mobile)or Receiver_mobile =:mobile #end If
The mobile parameter is NULL, then SQL does not stitch the text inside
However, if the "" (empty string) is passed in, the text will be stitched(Note: Of course, you can in the manager class will "" first turn to null, not afraid of trouble) if you have to judge null and empty, how to do it? should be written like this: #if ("$!{ Mobile} "! =" ") or Receiver_mobile =:mobile #end其中 $! {Mobile} is a VTL (quiet reference quiet Reference Notation) http://velocity.apache.org/engine/devel/user-guide.html# Quietreferencenotation
The official documentation describes this:If mobile
variable is null, or is not assigned a value,Direct use
${mobile}, the interface will display the variable name, i.e. (${mobile})
and with $! {Mobile}, blank text is displayed
This wiki is worth a look.Http://wiki.apache.org/velocity/CheckingForNull
Velocity determines if the variable is not empty or null