JSTL fn:escapeXml() function

The JSTL fn:escapeXml() function is used to escape the html, xml or any other tag which can be treated as xml markup.

Syntax:

String escapeXml(String giventring)

Example:

test.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>


	
		fn:escapeXml JSTL function example
	
	
		
		

String without using escapeXml function.

${testString}

String with using escapeXml function.

${fn:escapeXml(testString)}

web.xml


	
  
          test.jsp
  	


Output:

jsp example 56
 
Download this example.
 
Next Topic: JSTL fn:indexOf() function with example.
Previous Topic: JSTL fn:endsWith() function with example.