JSTL fn:trim() function

The JSTL fn:trim() function returns the input string after removing the all white spaces from both ends of the string.

Syntax:

String trim(String inputString)

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:trim JSTL function example
	
	
		
		Given String: 


String after trim:

web.xml


	
  
          test.jsp
  	


Output:

jsp example 66
 
Download this example.
 
Next Topic: Steps to create Custom tags with body in jsp with example.
Previous Topic: JSTL fn:toUpperCase() function with example.