Search code examples
pluginsjenkinsjenkins-pluginsjelly

Escaping special characters in Jelly for a Jenkins plugin


In my config.jelly for the page in question I want the default value to have a dollar sign in it.

For example,

<f:entry field="testField" name="testField" title="Test Field">
    <f:textbox name="testField" value="${testField}" default="${Non_Jenkins_Variable}" field="testField" />
</f:entry>

When I do the above, however, the ${Non_Jenkins_Variable} get interpreted and ends up being blank. I found http://wiki.servicenow.com/index.php?title=How_to_Escape_in_Jelly but apparently don't understand it enough to know what to do. I've tried &#36;{Non_Jenkins_Variable} and &amp;#36;{Non_Jenkins_Variable} with no luck. To be clear when the page is rendered I want the input box to have "${Non_Jenkins_Variable}" as the value.

thanks


Solution

  • Use $$ to escape the dollar sign. thanks Jesse Glick from the jenkinsci-dev google group.