最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - How to not escape chars in JSTL using c:out - Stack Overflow

programmeradmin2浏览0评论

i'm using JSTL <c:out> in my project to support javascript code, i have a string that comes from the servlet like this "2\'000;11\'222;10\'333" with javascript i'd like to split it to obtain separated values like 2'000;11'222;10'333....but when i use the <c:out> tag this "\'" becames "\&#039;" messing up the split function....

is there a way to tell JSTL not escape chars ?

stringaCompleta += 'Gennaio;<c:out value="${valori.value}" />';

i'm using JSTL <c:out> in my project to support javascript code, i have a string that comes from the servlet like this "2\'000;11\'222;10\'333" with javascript i'd like to split it to obtain separated values like 2'000;11'222;10'333....but when i use the <c:out> tag this "\'" becames "\&#039;" messing up the split function....

is there a way to tell JSTL not escape chars ?

stringaCompleta += 'Gennaio;<c:out value="${valori.value}" />';
Share Improve this question edited Sep 17, 2012 at 9:26 Medioman92 asked Sep 17, 2012 at 9:00 Medioman92Medioman92 5714 gold badges10 silver badges21 bronze badges 2
  • Please show the relevant snippet of your JSP code. – Tomalak Commented Sep 17, 2012 at 9:11
  • set attribute xmlOut="true" or xml="true" something like this – user1516873 Commented Sep 17, 2012 at 9:13
Add a comment  | 

1 Answer 1

Reset to default 17

Simply don't use the c:out tag at all:

stringaCompleta += 'Gennaio;${valori.value}';

Or use it with escapeXml set to false (but it's needlessly complex):

stringaCompleta += 'Gennaio;<c:out value="${valori.value}" escapeXml="false" />';

The documentation would have told you.

发布评论

评论列表(0)

  1. 暂无评论