wavetree
wavetree

Reputation: 1557

JSTL escapeXml default

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.

Upvotes: 9

Views: 21518

Answers (1)

JB Nizet
JB Nizet

Reputation: 691645

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.

Upvotes: 16

Related Questions