Search code examples
javascripthtmlvelocity

Concatenate string in HTML tag


I'm using Apache Velocity and need to append a string to a variable that I'm accessing using velocity.


Here's my current code with the desired functionality.

<div id="$settings.name" + "Setting"></div>

$settings.name is a variable being parsed by Velocity and "Setting" is the literal I want to append to it.


Can anyone provide me some information on how to achieve this?


Solution

  • A cursory google search has revealed the answer:

    http://velocity.apache.org/engine/1.7/user-guide.html#string-concatenation

    It looks like you'll need to write it like this:

    id="${settings.name}Setting"