You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by David Esposito <es...@newnetco.com> on 2001/02/20 17:04:56 UTC

values not in Context

Is there a way to have Velocity just print out nothing ("") for values that
it can't find in the Context when parsing the page? Right now, it prints out
the VTL expression $whatever if "whatever" is not in the hashtable.

Thanks in advance.


Re: values not in Context

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
David Esposito wrote:
> 
> Is there a way to have Velocity just print out nothing ("") for values that
> it can't find in the Context when parsing the page? Right now, it prints out
> the VTL expression $whatever if "whatever" is not in the hashtable.
> 
> Thanks in advance.

Use the 'quiet reference' notation :

$!whatever 

in your case.


-- 
Geir Magnusson Jr.                               geirm@optonline.com

Developing for the web?  See http://jakarta.apache.org/velocity

Re: values not in Context

Posted by Jason van Zyl <jv...@periapt.com>.

On Tue, 20 Feb 2001, David Esposito wrote:

> Is there a way to have Velocity just print out nothing ("") for values that
> it can't find in the Context when parsing the page? Right now, it prints out
> the VTL expression $whatever if "whatever" is not in the hashtable.

You can use the quiet reference notation:

You are the $!invisible man for all seasons.

If $invisible is in the context then the value will
appear, if not you'll get "" as you wish.

jvz.