${} template literal (ES2015) conflict with JSP EL syntax
You can put a backslash in front of the ${} so JSP ignores it (found out through this article by David Ford).
const subject = 'world';
let greet = `hello \${subject}!`
You have to move the JS code to the function inside the external file or script
tag, it would be the best way to solve conflict of jsp with JS syntax.