Inside my JSP, I simply print out my content as follows:
${article.body}
Of course, any HTML tags within that object are rendered, and that's expected behaviour. However within this content, I want to show everything within a <pre>
tag as plain text.
I know HTML can be escaped by using ${fn:escapeXML(article.body)}
or <c:out value="${article.body}" />
, but that will escape all the HTML, whereas I just need everything inside the <pre>
tag to be escaped.
I am using Java to generate the contents, and JSP as the view.
Any help would be greatly appreciated.