Difference between $value and $!value

Mokuyobi December 12, 2012

Hey there,

I looked on several edit.vm and view.vm to understand how everything works. But there is one different I do not understand: What is the difference between $value and $!value?

To me something like "#if (!$value)" would make sense. But a view.vm with only "$!value" instead of "$value" ? I don t get it!

Thanks in advance :)!

1 answer

1 accepted

0 votes
Answer accepted
Igor Sereda [ALM Works]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2012

Without "!" $value would generate velocity warning if value is null, and the substituted value will be in fact "$value", not replaced with en empty string.

See http://velocity.apache.org/engine/devel/user-guide.html#quietreferencenotation

Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2012

Suggest an answer

Log in or Sign up to answer