register
other register

Friday, November 09, 2007

Escape xml in JSTL

For <c:out> in JSTL:

<c:out value="<p>Hello</p>"/>

It will generate source code like:

& lt;p& gt;hello& lt;/p& gt;

And it will show the wording in the browser like:

<p>Hello</p>


Solution: put excapteXml="false" in.

<c:out escapexml="false" value="<p>Hello</p>"/>

It will generate source code like:

<p>Hello</p>

And it will show the wording in the browser like:

Hello

No comments: