Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to not escape chars in JSTL using c:out

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}" />';
like image 570
Medioman92 Avatar asked Dec 06 '22 12:12

Medioman92


1 Answers

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.

like image 169
JB Nizet Avatar answered Dec 28 '22 06:12

JB Nizet