Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSTL escapeXml default

Tags:

escaping

jsp

jstl

I know to avoid escaping HTML characters in JSTL to use this:

<c:out value="${my.value}" escapeXml="false" />

I am wondering if there exists a page directive to make escapeXml false by default, so I need not specify it on that particular page.

like image 433
wavetree Avatar asked Apr 11 '13 20:04

wavetree


1 Answers

The above does not escape HTML, since escapeXml is set to false. By default, escapeXml is true, and the <c:out> tag thus escapes the HTML. If you don't want to escape, you could simply use

${my.value}

and avoid using <c:out> completely, since the only purpose of <c:out> is to escape HTML.

like image 128
JB Nizet Avatar answered Nov 09 '22 15:11

JB Nizet