0
<% String email =(String) request.getSession().getAttribute("email"); 
   session.setAttribute("email", email);
%>

<script>
function test() {
var email = ${fn:escapeXml(email)}
}
</script>

Above does not work I have also tried put quotes "${fn:escapeXml(email)}"; or '${fn:escapeXml(email)}'; or "${fn:escapeXml(email)};" .... and none of them are working. I have also tried

If I do <span id="email" value="${fn:escapeXml(email)}">${fn:escapeXml(email)}</span>

It says cannot find function fn:escapeXml

Error message I got was: Uncaught SyntaxError: Invalid or unexpected token How do I set scriptlet to variable in javascript?

logger
  • 1,983
  • 5
  • 31
  • 57
  • Have you tried doing an online search for `fn:escapeXml`? – Erik May 31 '19 at 20:18
  • yes, but most of the use case is in html directly. I have not seen it could be set within javascript. there is also https://stackoverflow.com/questions/3735900/what-is-the-difference-between-escapexml-and-escapehtml but it is not working for me. I have libtag imported....so i m not sure what is wrong. – logger May 31 '19 at 20:31

0 Answers0