<head> #set($test = "works")) </head>
<script>
var get = "${test}"; // I also tried using '$test' and "$test" also
alert(get);
</script>
And it alerts out ${test}, but should print works.
How can I get it to work?
<head> #set($test = "works")) </head>
<script>
var get = "${test}"; // I also tried using '$test' and "$test" also
alert(get);
</script>
And it alerts out ${test}, but should print works.
How can I get it to work?
I realize the question is old, but this worked for me:
Need to include quotes around the variable in the alert since it is a string.
try this...
THIS WORKS SURELY!!!!
Try
var get = "$test";
instead ofvar get = "${test}";
Just use it as in html:
I had that problem while using tiles, the only way i got it to work was to use the jstl c:out tag, like:
that should work, and remember to add the jstl include on the top of the page