velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <>
Subject RFE: null support
Date Sat, 04 Dec 2004 15:11:43 GMT
Hi all,

If Velocity were to support null, how would you expect it to behave?

Some thoughts:

1. The word "null" should be treated as null in Velocity specific content.

#set ($list = ["one", null, "three"])
should make a 3 element list, with the elements "one", null and "three".

should call the "bar" method of the "foo" object with a null parameter.

2. The "set" directive should accept null value as the RHS.

Assuming that $bar wasn't in the Context,
#set ($foo = $bar)
#set ($foo = null)
should both remove "foo" from the Context.

3. The "foreach" directive should set null when the element is null. 
Currently, it preserves the last element.

#set ($list = ["one", null, "three"])
#foreach ($foo in $list)
should output:


4. The "if" directive should be able to compare references with null.

#if ($foo == null)
foo is null
should output
foo is null
if foo was not in the Context.

if ($foo != null)
foo is not null
should output
foo is not null
if foo was in the Context.

Any comments, opinions, etc.?

Related bugzilla issues:
Related list postings:

Best regards,
-- Shinobu Kawai

Shinobu Kawai <>

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

View raw message