Actually, in that case the $isNull inside the if statement throws the
ParserConfigurationException.
Thanks though,
Seth
-----Original Message-----
From: Christopher Schultz [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 05, 2008 11:46 AM
To: Velocity Users List
Subject: Re: quiet reference doesn't throw exception
Seth,
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
#if($isNull)
(nothing)
#else
$!isNull
#end
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 ;)
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]