$ {} template literal (ES2015) conflicts with JSP EL syntax

$ {} is used by both JSP and JS, so what happens is that $ {} in JS template literals is interpreted and deleted before being compiled into servlets. Is there a way in which Java can ignore $ {} without completely disabling the function using isELIgnored?

const subject = 'world'; let greet = `hello ${subject}!` 

turns into the next in the browser

 const subject = 'world'; let greet = `hello !` 

Here, the best I came up with is really not digging how ugly it is.

 <c:out value="var body = `pq_country=${country}&pq_population=${population}`;" escapeXml='false'/> 
+5
source share
1 answer

You need to move the JS code into a function inside an external file or script tag, this would be the best way to resolve jsp conflict with JS syntax.

+1
source

All Articles