27 October, 2014

www.liferaysolution.com feedback

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.

17 October, 2014

Escape HTML using JSTL

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;'))}

Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...