Escape Quote - javascript, struts 2
Posted
by
Ahmed Salah
on Stack Overflow
See other posts from Stack Overflow
or by Ahmed Salah
Published on 2012-03-30T23:03:41Z
Indexed on
2012/03/30
23:30 UTC
Read the original article
Hit count: 412
I read some struts2 variable in javascript as follows:
<javascript type="text/javascript">
var data='<s:property value="simulationInfos"/>';
<javascript>
If my simulationInfos contains single quote ', I get the error : unexpected identifier.
therefore, I tried to escape the quote as follows:
var data='<s:property value="simInfos" escapeJavaScript="true"/>';
and var data='<s:property value="simInfos" escapeHTML="true"/>';
I get the error: Attribute escapeJavaScript (or escapeHTML) invalid for tag property according to TLD.
Any Idea?
© Stack Overflow or respective owner