Q:

escaping dollar sign in velocity

I have such a string in the velocity template file:
<a id="superurl_${getItemid()}" href="http://example.com?$param1=345&$param2=abf&param3=${par3}">link1</a>

That renders as
<a id="superurl_1288" href="http://example.com?$param1=345&$param2=abf&param3=${par3}">link1</a>

However, it should be rendered as
<a id="superurl_1288" href="http://example.com?$param1=345&$param2=abf&param3=zzz">link1</a>

How to modify the source so that ${par3} rendered by its value and is not treated as a part of the string? 

A:

You can use #[[ .. ]]# to escape strings in Velocity.  I think in your case the preceding $ may be conflicting with what goes after them.  Try the following:
<a id="superurl_${getItemid()}" href="#[[http://example.com$param1=345&$param2=abf&param3=]]#${par3}">link1</a>

Also, make sure you actually pass a variable called "par3". ( This is more likely to be the reason why it's not parsed?)