Simon Christian <simon@stoutstick.com> wrote:
> Mike Kienenberger wrote:
> > So you really either need to use the tool or do this:
> >
> > #if ((! $car.fuel) && ("$!car.fuel" == ""))
> >
> > -Mike
> >
>
> No the first bit isn't necessary, just #if( "$!car.fuel" == "" ) covers
> the eventualities when testing for null.
That's not true.
car.fuel = "" is not the same as car.fuel = null, yet both pass the
condition.
Unless the template designer knows the underlying type of the java object,
the only safe solution is to check for "(null or false) and (null or
empty-string)" => if true, must be null.
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
|