I’m working with a JSP file which includes others, but as it’s used for an AJAX response the included files need to be escaped. My initial attempt was this:
<%=StringEscapeUtils.escapeJavaScript(<%@include file="file.jsp"%>)%>
which gives this error:
Syntax error, insert ")" to complete Expression
This is clearly incorrect, but should show what I’m trying to do. Is there anyway accomplish what I’m trying?
In the end this was solved by replacing all double-quotes with single-quotes, removing newlines, and by chance any parts with both double- and single-quotes was removed so didn’t cause problems.