www.liferaysolution.com feedback

Monday, October 27, 2014

Hello Friends,

We have completed around more than 2 years with www.liferaysolution.com and sharing many useful Liferay solutions and important information about liferay development as well as other useful stuff.
I am sure your valuable inputs/feedback will help us to provide more better way to provide solutions and support on liferay.

Escape HTML using JSTL

Friday, October 17, 2014

Hello Friends,

If you are using JSTL to display HTML data in your application then you can escape HTML 2 ways in JSTL:

1) Using <c:out> tag
<c:out value="${specialCharString or HTML}" escapeXml="true"/>

2) Using EL Function

${fn:escapeXml("<i> This is jignesh vachhani")} 

Hope this will be useful somewhere.

If you want to use Liferay API then you can simply use

HTMLUtil.escape(String HTMLString)


Show/Display HTML tag in jsp

${fn:escapeXml(fn:replace(fn:replace(fn:replace("<div><p>This is jignesh testing</p></div>",'"','&quot;'),'<','&lt;'),'>','&gt;'))}
 

Members