I have to secure a java web application against XSS attacks. There are parts of the code that look like this:
<script>
  jsvariable = ${jspvariable}
  use(jsvariable)
<script>
My first tough was to do something like this:
<script>
  jsvariable = ${fn:escapeXml(jspvariable)}
  use(jsvariable)
<script>
But escapeXml doesn't avoid XSS inside a script tag. What's the correct way to send a value from jsp to javascript.