Closed biehu closed 7 years ago
I can't, in fact. There is no way to support template tags in JS code. For example:
<script>
var foo = <%= bar %>;
</script>
To make sure that "bar" is a valid JS expression, we have to evaluate the JSP code. My advice is to cheat a little bit, like this:
<script>
var foo;
// <%= "\nfoo = " + bar %>
</script>
Or if you want a comment
<script>
// <%-- This is a comment --%>
</script>
(This is probably not valid JSP code, but I hope you get the idea)
code: <%-- --%> error: error Parsing error: Unexpected token %