You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Mark Lybarger <Ma...@CBC-Companies.com> on 2003/09/15 14:16:12 UTC

yet another null question

i have a macro that's used to render html output.  the macro input could be
null, but if it is, i'd like to to always output a html blank space
(&nbsp;).  if the value is null, it seems to be not rendering anything.  any
suggestions?

--------------

#macro (blankValue $displayValue )
	#if ($displayValue != "") 
		$displayValue
	#else 
	    &nbsp;
	#end
#end


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.509 / Virus Database: 306 - Release Date: 8/12/2003
 


Re: yet another null question

Posted by Daniel Graham <da...@gr8.tv>.
remove the condition

#if ($displayValue)
     $displayValue
#else
     &nbsp;
#end

null's evaluate false

DG

Mark Lybarger wrote:

> i have a macro that's used to render html output.  the macro input could be
> null, but if it is, i'd like to to always output a html blank space
> (&nbsp;).  if the value is null, it seems to be not rendering anything.  any
> suggestions?
> 
> --------------
> 
> #macro (blankValue $displayValue )
> 	#if ($displayValue != "") 
> 		$displayValue
> 	#else 
> 	    &nbsp;
> 	#end
> #end
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.509 / Virus Database: 306 - Release Date: 8/12/2003
>  
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 

-- 
Dr Daniel Graham
Product Strategy Manager
Video and Image Coding Specialists
daniel.graham@videocoding.com
http://www.videocoding.com
Tel : [+44|0] 870 241 4618