I have this code bit:
var description = '${requestScope.description}';
In the above code if
${requestScope.description} = '''''''''
IE is throwing script error. How to solve this problem?
Can you fix it using the technique mentioned in https://stackoverflow.com/a/1473192/476786 as suggested by @xdazz .
If not, try using double quotes as follows:
var description = "${requestScope.description}";
Edit: OP says that description
could also potentially contain " (double quotes) :
In that case, you could replace the double quotes before you output the string as:
var description = "${requestScope.description.replace("\"", "''")}";
This would replace all instances of double quotes with 2 single quotes.
Please note that my jsp
isvery weak, and as such the code sample above might need a tweak or two... :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.