You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by RIBEIRO Paulo Jorge <pr...@enabler.pt> on 2002/06/14 20:44:02 UTC

null values

Hello,

Let's suppose that I have a template with the following content "$var1".
If I put a null value in the context, I will not have the null value in the
result. Instead it will apperar the "$var1" string, and I'll have a
ReferenceException in my log file.
It is possible to use the null value? I can have a template with the value
"$var2.print($var1)", and my method can handle null values. The problem is
that I will have the ReferenceException and the result value will be
"$var2.print($var1)".

Thanks,

Paulo

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: null values

Posted by Nathan Bubna <na...@esha.com>.
RIBEIRO Paulo Jorge said
> It is possible to use the null value?

this does remind me... what is the status of
discussions/decisions/implementations concerning the addition of a null
token of sorts to velocity? and also, there was once discussion about
somehow allowing the #set behavior to 'unset' a variable when the RHS
evaluates to null.  i'd still really like to see that.  is this a good time
to bring this stuff up again? there seems to be a lull in the ongoing
debates over whitespace handling and supporting doubles.  perhaps it's a
good time to deal with a smaller controversy like this... :-)

Nathan Bubna
nathan@esha.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: null values

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 6/14/02 2:44 PM, "RIBEIRO Paulo Jorge" <pr...@enabler.pt> wrote:

> Hello,
> 
> Let's suppose that I have a template with the following content "$var1".
> If I put a null value in the context, I will not have the null value in the
> result. Instead it will apperar the "$var1" string, and I'll have a
> ReferenceException in my log file.
> It is possible to use the null value? I can have a template with the value
> "$var2.print($var1)", and my method can handle null values. The problem is
> that I will have the ReferenceException and the result value will be
> "$var2.print($var1)".
> 

Use the 'quiet reference' notation if you want it to not be there :

$!var1

Does that solve it for you?

I think there is a properties setting to quiet the yammering in the log file
as well.

-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>