velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Seth Rosenblum" <>
Subject RE: quiet reference doesn't throw exception
Date Mon, 07 Jul 2008 14:51:07 GMT
Actually, in that case the $isNull inside the if statement throws the

Thanks though,

-----Original Message-----
From: Christopher Schultz [] 
Sent: Saturday, July 05, 2008 11:46 AM
To: Velocity Users List
Subject: Re: quiet reference doesn't throw exception


Seth Rosenblum wrote:
> I'm using the velocity engine with ParseErrorException throwing turned

> on because it greatly simplifies unit testing, as it just checks that 
> every value on the page has been filled in.  However, I'd like 
> velocity to not throw an exception when I pass it a quiet reference 
> e.g. $isNull should throw an exception, but $!isNull should just 
> resolve to being empty.  Is there a way to do this?

How about


This is quite verbose, but it will get the job done.

I've always been a proponent of something like ReferenceTools that would
allow you to do things like directly check for null and false (because
null == false in VTL) so you wouldn't have to use tricks like these to
get around this behavior. I've just been too lazy to do anything about
it so far ;)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message