I would like to ask about using template literals es6 syntax along with struts dollar variable sign
In a jsp i have a script which looks like this :
let formSelector = "form#saveForm div";
let inputPrefix = `<input type='hidden' name='compositeEx[${index}]'`;
console.log(`index${index}`);
the thing is that when i console.log i get only index
without the index value.
if i do
console.log(`index`+index);
it prints the value i want
I am wondering if there is a confict with struts2 ${value} usage and es6 template literals feature there is any documentation for this or a way to use template literals along with struts
Ok, i tried to escape the dollar sign and it worked I guess struts rendering on server renders this:
console.log(`index${index}`);
to this (index is available after a js function call on jsp script tags context)
console.log(`index`);
escaping dollar sign :
console.log(`index\${index}`);
renders to this
console.log(`index${index}`);
which is usable by javascript