If you are doing a test for java 'null' value, then #if ($car.fuel) will return true if $car.fuel is NOT a java null value.
If you are checking for an empty string, then use the String comparison. #if ($car.fuel=="") If you want to check for both: #if ($!car.fuel=="") I have a general purpose tool with a method that checks for null or empty or all blanks and include the tool object in all Velocity contexts. #if ($tool.isEmpty($car.fuel)) You may have a different requirement that would require a special method. Perhaps you want it to return false if fuel is null or empty or the value 0. Then you would have to create your own method in the $car object. #if ($car.hasFuel()) BTW, always use '==' instead of '=' when making comparisons in Velocity. Barbara Baughman X2157 On Thu, 2 Dec 2004, THE ULTIMATE SUBBIAH wrote: > How to check for null in velocity > for eg. I load a class in the context Class:: car > > #if ($car.getFuel() = null ?? ) > > This does not work. > Thx > > _________________________________________________________________ > The happening world of BPO! Know all that you need to know! > http://www.bpowatchindia.com/msn/ Keep in step with what’s hot! > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]