Share on Google+Share on Google+

Use of Tag of JSTL

In this section, you will learn how to use Tag of JSTL.

Use of <fn:escapeXml(String)> Tag of JSTL


In this section we will learn how to use <fn:escapeXml>  Tag of JSTL. This tag is used to escape characters that could be interpreted as XML markup. This takes string type as argument and also returns string type.

Syntax :
java.lang.String escapeXml(java.lang.String)






<%@ taglib prefix="c" uri="" %>
<%@ taglib prefix="fn" uri="" %>
        <title>Example of fn:escapeXml Tag</title>
                <c:set var="str1" value="This is first String."/>
        <c:set var="str2" value="This <abc>is second String.</abc>"/>
        <c:set var="str3" value="<mahendra>This is first String.</mahendra>"/>
        <table border="1">
                <th>without fn:escapeXml</th>
                <th>with fn:escapeXml</th>

This jsp code shows the following output :

Download Source Code



Posted on: August 24, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Use of Tag of JSTL  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image